Estou estudando PL/SQL e testando o uso de CURSOR, porém não estou conseguindo testar um exemplo:
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;
Erro:
Relatório de erros - ORA-06550: linha 17, coluna 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:
begin, if, open, loop
etc