From a User Defined Function, I can assign multiple variables in a
single statement as follows:
-- Get the first update transaction for the mailing event.
set (fUpdateTS, fAddrType, fAccountID, fOpCode) =
(select AddTS, UpdateTypeCode, AccountID, OpCode
FROM
(select AddTS, UpdateTypeCode, AccountID, OpCode,
row_number() over(order by AddTS) as RNUM
from CANSAccountUpda tes c
where c.MailingEventI D = pMailingEventID
and c.UpdateTypeCod e IN('LEGAL', 'JLEGL', 'ML',
'JML')
) as tmp
WHERE RNUM = 1
);
but when I try to use the same statement in a stored procedure, I get
the error when trying to compile:
SQL0104N An unexpected token "set" was found following " ". Expected
tokens may include <psm_while>. Line Number=78. SQLSTATE=42601.
Is there different way to assign multiple variable from SQL statement
in a DB2 stored procedure?
Many thanks,
Bob