Subject Return Result from Stored Procedure
Author Kongthap Thammachat
Dear All

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
END^
SET TERM ; ^

I really don't know why is that line get error, please help, I really
new to Firebird.

P.S. Firebird 2.5

Thanks.
Kongthap.