Q ues : How to avoid using cursors? What to use instead of cursor and in what cases to do so?
For emprec in (select * from emp)
This built-in package allows you to turn on execution profiling in a session. Then, when you run
your code, Oracle uses tables to keep track of detailed information about how long each line in
your code took to execute. You can then run queries on these tables or—much preferred—use
screens in products like Toad or SQL Navigator to present the data in a clear, graphical fashion.
Use this built-in function to calculate the elapsed time of your code down to the hundredth of a
second. The scripts tmr.ot and plvtmr.pkg (available on the book’s web site) offer an interface to
this function that allows you to use “timers” (based on DBMS_UTILITY.GET_TIME) in your
code. These make it possible to time exactly how long a certain operation took to run and even to
compare various implementations of the same requirement.