Cursor-Getting Error

Database
Enthusiast

Cursor-Getting Error

Hi Experts,

I am getting following error whlie creating cursor.Please help me.

 

Create procedure Order_Proc()

 

Begin

Declare K INTEGER default 0;

Declare V_TOTAL INTEGER default 0;

Declare v_empno INTEGER;

Declare v_ename Varchar(10);

Declare C1 CURSOR FOR SELECT empno,ename from EMP_1 where empno is not null;

OPEN C1;

Fetch C1 into v_empno,v_ename;

Set K=K+1;

UPDATE JJ_JMP3_NEW FOSF

SET "AGENCY"=C2.ORGIN_CLIENT_NAME

WHERE FOSF."ORDER ID"=C2.ORDER_ID AND FOSF."AGENCY" <> ‘SELFPROV-SELF PROVISIONING VIDEO REMOTE’;

IF( K>1000) THEN

V_TOTAL=V_TOTAL+K

INSERT INTO ODS.VID_IS_ACTV_LOG VALUES (SYSDATE,V_TOTAL);

set K=0;

end If;

Close C1;

End;

 

SPL1048:E(L14), Unexpected text 'V_TOTAL' in place of SPL statement.

SPL1008:E(L14), Unexpected text 'V_TOTAL' in place of literal or system variable.

SPL1027:E(L15), Missing/Invalid SQL statement'E(3707):Syntax error, expected something like ';' between a name or a Unicode delimited identifier and the word 'V_TOTAL'.'.

Thanks,

Amarnath G

1 REPLY
Senior Apprentice

Re: Cursor-Getting Error

Hi Amarnath,

IF( K>1000) THEN

SET V_TOTAL=V_TOTAL+K;

Dieter