Trying to run the following code and getting an error.
Just want to loop thru two varchar cursors, and do a slightly different action depending on which iteration the loop is on.
There is seemingly something wrong with the curdsor variable in the IF statement, but I cant figure it out.
Any help is appreciated!
DECLARE
VAR_TYPE VARCHAR;
c4 CURSOR FOR SELECT DATA_TYPE FROM TYPES;
BEGIN
CREATE OR REPLACE TEMPORARY TABLE OBJECT AS (
SELECT Z.*, D.KEY
FROM DATA Z
LEFT JOIN DIMENSION D
ON Z.ID = D.ID;
OPEN c4;
FOR CLASS_TYPE IN c4 DO
VAR_TYPE := CLASS_TYPE.DATA_TYPE;
IF (:VAR_TYPE = 'OLD')
THEN (DELETE FROM OBJECT WHERE KEY IS NOT NULL) ;
END IF;
END FOR;
CLOSE c4;
END;