Pl-SQL

Document Sample
Pl-SQL Powered By Docstoc
					Q ues : How to avoid using cursors? What to use instead of cursor and in what cases to do so?
ANS:

For emprec in (select * from emp)
loop
dbms_output.put_line(emprec.empno);
end loop;




DBMS_PROFILER

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.

DBMS_UTILITY.GET_TIME

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.


				
DOCUMENT INFO
Categories:
Tags:
Stats:
views:19
posted:11/20/2010
language:English
pages:1