CREATE OR REPLACE FUNCTION PPP ()
RETURNS cursor
F1: BEGIN ATOMIC
declare c1 cursor ;
set c1 = CURSOR FOR select * from aaa ; {get error here}
RETURN c1 ;
END
My error is
A.PPP - Deploy started. Create user-defined function returns SQLCODE: -104, SQLSTATE: 42601. A.PPP: 6: An unexpected token "FOR" was found following " set c1 = CURSOR". Expected tokens may include: "<compound_SQL_stmts1>".. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.19.56 An unexpected token "FOR" was found following " set c1 = CURSOR". Expected tokens may include: "<compound_SQL_stmts1>".. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.19.56 A.PPP - Deploy failed. A.PPP - Roll back completed successfully.
If i wrire set c1 = ... in Stored Procedure, i don't get error