I have written lots of RPG/ILE & CL & COBOL programs in iSeries. I never worked on procedures & UDF. Now I'm learning these. I'm trying to create a procedure.
This is the code. It's compiled without any errors. While running I got the below error.
CREATE FUNCTION SUS.REWT(p_value DATE)
NO EXTERNAL ACTION
F1: BEGIN ATOMIC
DECLARE D1 DATE;
DECLARE return_date DATE;
DECLARE RANDOM_VALUE INTEGER;
SET D1= TO_DATE('1990-01-01','YYYY-MM-DD');
--SET D1 = (SELECT DATE(p_value) FROM SYSIBM.SYSDUMMY1);
SET RANDOM_VALUE = CAST (( RAND () * 10000)as INT );
SET D1 = D1 + RANDOM_VALUE DAYS;
While running, I'm getting the below error:
[SQL0029] INTO clause missing from embedded statement.
I don't understand what is the need of INTO clause here.
DB2: DB2/400 V5R4
Client: IBM data studio