DECLARE
CURSOR emp IS
SELECT first_name,last_name FROM hr.employees;
my_emp2 emp%ROWTYPE;
fir_name hr.employees.first_name%TYPE;
BEGIN WITH emp_temp AS ( SELECT first_name FROM hr.employees WHERE first_name = 'Ellen' ) SELECT first_name INTO fir_name FROM emp_temp;
DBMS_OUTPUT.PUT_LINE( 'first_name
OPEN emp;
LOOP
FETCH emp INTO my_emp2;
EXIT WHEN emp%NOTFOUND;
DBMS_OUTPUT.PUT_LINE( 'fetch
END LOOP;
CLOSE emp;
FOR eachemp IN emp LOOP
DBMS_OUTPUT.PUT_LINE( 'for
END LOOP;
END;
/
SELECT * FROM V$OPEN_CURSOR
原文链接:https://www.f2er.com/oracle/210435.html