HI,

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)
RETURNS DATE
LANGUAGE SQL
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;
SET return_date=D1;

RETURN return_date;
END

while running I m getting the below error:
Run: SUS.REWTDATE)

[SQL0029] INTO clause missing from embedded statement.


I don't understand what is the need of INTO clause here.

OS: WIndows
DB2 : Db2/400 V5R4
Client : IBM data studio