hello guys in this tutorial we are going to learn the implicit cursor So,
first we under stood that what is the implicit cursor :
A implicit cursor is the system cursor where all the event are stored in there. the entire place of memory allocation for the Oracle engine is called context area. the context area is contain all the event which are process.
A cursor is the simple pointer which is only retrive the data from the context area. and all the data(event) are stored in context area in temporally.
when we closed our sql software then the memory allocation of context area in remove. the main point in our sql system is that
- DDL(data definition language )
- DML(data manipulate language)
but when we fired any DML command then we can perform ROLL BACK to backup out DATA.
when we fired ROLL BACK then the SQL(implicit cursor) is retrive the data from context are and it Display the ROLL BACK is complete.
that means the DML events are stored into the context area in temporary.
So,the main purpose is the cursor that it retrive the data from the context area.
there are two type of cursor
implicit explicit
SQL> select *from customer; AC_NO B_NO NAME CITY BALANCE COUNT CHK_DATE ---------- ---------- ---------- ---------- ---------- ---------- --------- 111 101 biku surat 7990 1 02-SEP-19 112 103 sunil vapi 11000 1 02-SEP-19 113 102 balram valsad 19000 3 01-JAN-19 114 104 jenna surat 18000 2 01-JAN-19 115 105 sagar mumbai 9000 1 01-JAN-19 116 101 chirag surat 800 3 01-JAN-19 117 102 aditya vapi 500 5 01-JAN-19 118 103 rahul valsad 14000 2 01-JAN-19 119 103 bhavesh mumbai 5000 1 01-JAN-19 120 104 jay surat 400 4 01-JAN-19 121 105 bhola vapi 11000 4 01-JAN-19 AC_NO B_NO NAME CITY BALANCE COUNT CHK_DATE ---------- ---------- ---------- ---------- ---------- ---------- --------- 122 101 mina valsad 8000 2 01-JAN-19 123 102 montu surat 9000 2 01-JAN-19 13 rows selected.
SQL> select *from customer where ac_no=122; AC_NO B_NO NAME CITY BALANCE COUNT CHK_DATE ---------- ---------- ---------- ---------- ---------- ---------- --------- 122 101 mina valsad 8000 2 01-JAN-19
And we update the name of mina to sima
update customer set name='sima' where ac_no=122; 1 row updated.the background process is updated.
declare m_name varchar2(10); begin update customer set name='sima' where ac_no=122; if sql%found then dbms_output.put_line('data is found'); else dbms_output.put_line('data is not found'); end if; end; /
SQL> @C:\Users\Vibhuti\cursor.sql data is found PL/SQL procedure successfully completed.
here the sql cursor is checked that the updated statement is found or not.
if it is found then it return data is found and if the data is not found then it return data is not found.
So, the implicit cursor is work like above.
this article is written by chirag patil if you like this article then comment to him and
If you like code with vibhu and would like to contribute, you can also write an article using This link :
https://docs.google.com/forms/d/e/1FAIpQLScAmvlPvNUz35R-G0nc_zpRVP3o8xlhtFgC3aKPyLetX_RyXg/viewform?pli=1
OR mail your article to bibhutiswain990@gmail.com. See your article appearing on the code with vibhu main page and help other students.
❮ Previous Next ❯
0 Comments