Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1


Ratings: (0)|Views: 118|Likes:
Published by anon-470976

More info:

Published by: anon-470976 on Jul 10, 2008
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less





PL/SQL DemystifiedThe best way of learning something is by asking questions. That's why I've organized thishub in a question-answer format.The questions range from Basic to Advanced. I gave a concise answer too, only for quick reference and revision. For detailed answer to each question, refer to any Oracle PL/SQLonline documentation.Some of these questions were actually asked in my Job Interviews in the US.I have added some others which I found interesting. Very useful to know.What is a cursor ? ( Basic)- Name or handle to a private SQL area where Oracle parses and fetches query results.How to control how many cursors are open ?(Intermediate)- Set OPEN_CURSORS parameter in initialization parameters.What is shared SQL ? (Intermediate)-Oracle recognizes similar statements. The SQL area is used many times for similar statements.What is Parsing ? (Intermediate)- Syntax checking, privileges checking, allocating Private SQL Area.What is the difference between anonymous blocks and stored procedures ? ( Basic)- Anonymous block is compiled only when called.- Stored procedure is compiled and stored in database with the dependency informationas well.- Former is PL/SQL code directly called from an application. Latter is stored in database.- Former has declare statement.Latter doesnt.
What are the advantages of procedures ? ( Basic)- Loaded once and used many times- Performance better coz all SQL stmts are sent in one go from the application to thedatabase- Security ( no object privileges are given directly )- Invoker's rights possible- Data integrity, productivityWhat are standalone procedures ? (Basic)- Those that are not part of packageHow is a PL/SQL program stored in database ? (Advanced)- Parsed code is stored. It's called P-codeHow is a PL/SQL program executed ?(Advanced)- Prior to Oracle 9i, we have only bytecode and a virtual machine in the database runs it.Later versions have faster native code execution.- PL/SQL engine is the main component that executes procedural stmt and passes theSQL to the SQL statement executor.What are the advantages and disadvantages of DBMS_SQL ? (Intermediate)- It has all the advantages of dynamic sql .. like runtime construction of sql, DDLstatements can be executed.- Its advantage over EXECUTE IMMEDIATE is it can Describe objects- It's kind of bulky and difficult compared to EXECUTE IMMEDIATE.What is a package spec and package body ? Why the separation ? ( Basic)
- Spec declares public constructs. Body defines public constructs, additionally declaresand defines Private constructs- Separation helps make development easier - Dependency is simplified. You can modify body without invalidating dependent objects.What are the advantages of Packages ? ( Basic)- Encapsulation of code logic- Privileges to objects can be controlled- Loaded once into memory , used subsequently.- Dependency simplified- Public/private procs, functions, variablesHow do you handle exceptions for bulk operations ? (Intermediate)- Use the SAVE EXCEPTIONS clause ( FORALL index IN bound_clause SAVEEXCEPTIONS LOOP ... END LOOP )- Use 'Exceptions When Others' to handle the exceptions- SQL%BULK_EXCEPTIONS(i).ERROR_CODE,SQL%BULK_EXCEPTIONS(i).ERROR_INDEXSQL%BULK_EXCEPTIONS.COUNTTell some tips to avoid performance problems in PL/SQL. (Intermediate to Advanced)- Use FORALL instead of FOR, and use BULK COLLECT to avoid looping many times- Tune SQL statements to avoid CPU overhead- Use NOCOPY for OUT and IN OUT if the original value need not be retained.Overhead of keeping a copy of OUT is avoided.- Reorder conditional tests to put least expensive ones first

Activity (6)

You've already reviewed this. Edit your review.
1 hundred reads
phbnaidu liked this
Dipankar liked this
Dipankar liked this
mamehedi liked this
venkateshoracle liked this

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->