Friday, March 9, 2018

PL/SQL - SELECT statement using cursor

DECLARE
       CURSOR c_deptno IS SELECT first_name, salary, department_id
       FROM EMP;
BEGIN
     For x in c_deptno
    Loop
     dbms_output.put_line(x.first_name ||' '||x.salary||' '||x.department_id);
    End loop;
     close c_deptno;
End;

output:
        Steven 24000 90
        Neena 17000 90
        Lex 17000 90
        Alexander 9000 60

No comments:

Post a Comment