Subject | Re: Optional parameter in a select statement |
---|---|
Author | m_formigoni |
Post date | 2005-08-29T17:51:08Z |
Thanks a lot!!! This will be very useful in my application!!
Mauro.
Mauro.
> create procedure Teststatement
> returns ( SomeVal int) as
> declare variable command varchr(500);
> begin
> command='Select AValue from Atable';
> for execute statement command
> into :SomeVal Do
> begin
> suspend;
> end
> end
>
> actually, there is not necessarily a need to store the SQL in the
> variable, you could write it/build it directly in the execute
> like....
>
> create procedure Test2 (FieldName varchar(31))
> returns ( SomeVal int) as
> begin
> for execute statement 'Select ' || :FieldName || ' from Atable'
> into :SomeVal Do
> begin
> suspend;
> end
> end