How to write SQL function in SQL script

Options
deep_215
deep_215 Registered Posts: 9 ✭✭✭

Hi,

I am trying to write a SQL function in SQL script

CREATE OR REPLACE FUNCTION fun1() RETURNS VOID AS

DECLARE
VAR_VALUE INTEGER;
e RECORD;
BEGIN
for e in select col1,col2 from table
Loop
--BODY OF FUNCTION
END LOOP;
END;

I am getting error while running the code in DECLARE section stating unexpected <EOF>.

Can anyone help me to get rid of this issue and help me in executing the SQL Script for SQL function.

Thanks in advance.

Regards,

Deepak

Answers

Setup Info
    Tags
      Help me…