Subject Re: Optional parameter in a select statement
Author m_formigoni
Thanks a lot!!! This will be very useful in my application!!

Mauro.


> create procedure Test
> 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
statement
> 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