Cursor is nothing but th pointer..
stpes to create and use the cursor
1) DECLARE THE CURSOR.
2)OPEN THE CURSOR
3)FETCH THE CURSOR
4)CLOSE THE CURSOR.
Ex---create a cursor to disply the all name of emplpoee form emp table..
set serveroutput on
-------declare cursor-------------declare
cursor emp_cur
IS select ename from emp;
emp_rec emp_cur%rowtype;
begin
---------open the cursor----------open emp_cur;
----------Fetch the cursor--------fetch emp_cur into emp_rec;
dbms_output.put_line('NAME=>'||emp_rec.ename);
-----------close the cursor---------
close emp_cur;
end;
/
--------------------------------
stpes to create and use the cursor
1) DECLARE THE CURSOR.
2)OPEN THE CURSOR
3)FETCH THE CURSOR
4)CLOSE THE CURSOR.
Ex---create a cursor to disply the all name of emplpoee form emp table..
set serveroutput on
-------declare cursor-------------declare
cursor emp_cur
IS select ename from emp;
emp_rec emp_cur%rowtype;
begin
---------open the cursor----------open emp_cur;
----------Fetch the cursor--------fetch emp_cur into emp_rec;
dbms_output.put_line('NAME=>'||emp_rec.ename);
-----------close the cursor---------
close emp_cur;
end;
/
--------------------------------
No comments:
Post a Comment