0
I’m studying PL/SQL and testing the use of CURSOR, but I’m not able to test an example:
SET SERVEROUTPUT ON
DECLARE
V_NAME VARCHAR2(50);
CURSOR CUR_CURSOR IS
SELECT FIRST_NAME FROM EMPLOYEES;
TEMP CUR_CURSOR%ROWTYPE;
BEGIN
IF NOT CUR_CURSOR%ISOPEN THEN
OPEN CUR_CURSOR;
LOOP
FETCH CUR_CURSOR INTO TEMP;
EXIT
WHEN CUR_CURSOR%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(V_NAME);
END LOOP;
CLOSE CUR_CURSOR;
END;
Error:
Report of errors - ORA-06550: row 17, column 1: PLS-00103: Encountered the Symbol "END" when expecting one of the following:
if 06550. 00000 - "line %s, column %s:\n%s" *Cause: Usually a PL/SQL compilation error. *Action:
see if all structure commands start and came in the order that were declared, see
begin, if, open, loop
etc.– Ricardo Pontual