Subject | Re: [firebird-support] Return Result from Stored Procedure |
---|---|
Author | Helen Borrie |
Post date | 2012-03-21T01:24:05Z |
At 12:46 AM 21/03/2012, Kongthap Thammachat wrote:
./heLen
>Dear AllBecause you have no variable named RESULT. You declared YYMM for your return value.
>
>I wanna create a stored procedure to return 'YYMM' of the current date
>for using as part of my document ID
>
>This is my stored procedure PSQL so far
>
>SET TERM ^ ;
>CREATE PROCEDURE P_YEARMONTH_PREFIX
>RETURNS (
> YYMM Char(4) )
>AS
>declare YY char(2);
> declare MM char(2);
>BEGIN
> select substring(cast(extract(year from current_date) + 543 as
>char(4)) from 3 for 2)
> from rdb$database
> into :YY;
>
> select cast(extract(month from current_date) as char(2))
> from rdb$database
> into :MM;
>
> if (char_length(MM) = 1) then begin
> MM = '0' || MM;
> end
>
> result = YY || MM; -- why is this line get error
./heLen