Subject Re: [firebird-support] Re: Execute Block statement
Author Helen Borrie
At 11:46 AM 29/06/2008, you wrote:
>Hi,
>
>I am looking for a way to run certain codes multiple times (like a
>function call, without resorting to UDF) within a stored procedure, so
>that the same codes will not be repeated within a stored procedure.

You want an embedded procedure for this.

Example:

create procedure convert_my_value (input x smallint)
returns (output y varchar(25))
as
begin
Y = 'YADA TODAY IS ' ;
IF (X IS NOT NULL) THEN
Y = Y|| CAST (X AS VARCHAR(6));
ELSE
Y = Y|| 'UNSPECIFIED';
END

create procedure caller_proc (xx smallint, ...)
...
declare yada varchar(25));
begin
....
execute procedure convert_my_value (:xx)
returning_values(:yada);
...
end

./heLen