Oracle PLSQL Interview Questions. Additional Concepts Every Developer Should Know.

90

By rakeshfan

PL/SQL Demystified

The best way of learning something is by asking questions. That's why I've organized this hub 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/SQL online 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 information as 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 the database

- Security ( no object privileges are given directly )

- Invoker's rights possible

- Data integrity, productivity

What are standalone procedures ? (Basic)

- Those that are not part of package

How is a PL/SQL program stored in database ? (Advanced)

- Parsed code is stored. It's called P-code

How 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 the SQL 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, DDL statements 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 declares and 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, variables

How do you handle exceptions for bulk operations ? (Intermediate)

- Use the SAVE EXCEPTIONS clause ( FORALL index IN bound_clause SAVE EXCEPTIONS LOOP ... END LOOP )

- Use 'Exceptions When Others' to handle the exceptions

- SQL%BULK_EXCEPTIONS(i).ERROR_CODE,

SQL%BULK_EXCEPTIONS(i).ERROR_INDEX

SQL%BULK_EXCEPTIONS.COUNT

Tell 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

- Minimize datatype conversions => Assign data to exact same type variables

- Use PLS_INTEGER for computation intensive code. NUMBER, INTEGER maintain precision and scale but not optimized for performance as additional checks are made to maintain precision and scale.

- Do not use subtypes like POSITIVE, NATURAL, INTEGER as they have additional checks

- Use BINARY_FLOAT, BINARY_DOUBLE

- EXECUTE IMMEDIATE is faster than DBMS_SQL

How to know PL/SQL compile parameters ?(Advanced)

- SHOW PARAMETERS PLSQL

- ALL_PLSQL_OBJECT_SETTINGS

What is MERGE ?( Basic)

- Combination of INSERT and UPDATE

Tell some new features in PL/SQL in 10g (Intermediate to Advanced)

- Regular expression functions REGEXP_LIKE , REGEXP_INSTR, REGEXP_REPLACE, and REGEXP_SUBSTR

- Compile time warnings

- Conditional compilation

- Improvement to native compilation

- BINARY_INTEGER made similar to PLS_INTEGER

- INDICES OF , VALUES OF in FORALL lets you work on non-consecutive indices

- Quoting mechanism . Instead of quoting single quotes twice everytime, give your own delimiter to go on using single quotes.

Ex: q'!I'm a string, you're a string.!'

- Flashback Query functions. SCN_TO_TIMESTAMP, TIMESTAMP_TO_SCN

- Implicit conversion between CLOB and NCLOB

- Improved Overloading

- New datatypes BINARY_FLOAT, BINARY_DOUBLE

- Global optimization enabled

- PLS_INTEGER range increased to 32bit

- DYNAMIC WRAP using DBMS_DDL

What is a sequence ? (Basic)

- A database object that offers high-speed access to an integer value

- Guaranteed to be unique (within that sequence).

-Used commonly to generate Primary key values

Folks, check out http://hubpages.com/hub/oracle_sql_plsql for more questions.

COMMENTS AND SUGGESTIONS ARE WELCOME !!!!

Thanks all for the positive feedback!

Sridhar 5 years ago

Excellent !!

m3powers 5 years ago

Thanks for work!

ss 4 years ago

Great url referred.I think many users will be benefitted by this type of mails.Keep it Up.

Siva 4 years ago

Really done an excellent work..keep posting this sort of mails...Thanks

polesh 4 years ago

gr8..

srisan 4 years ago

Thanks for the questions set!!It helped alot..

subash 4 years ago

excellent. Keep posting this kind of questions. Thanks heaps

vgmanjare 4 years ago

it gives iot of imfarmetion

rakeshfan profile image

rakeshfan Hub Author 4 years ago

Thanks everyone for your positive feedback !

shiva 4 years ago

its exellent

Rashmi 4 years ago

Its a nice site significant to enhance knowledge and inteligence .

Bala 4 years ago

Really a good and excellent tips for the Oracle Workers...

pipa 4 years ago

Thanks for this url.

Manjula 4 years ago

Good work..

prem 4 years ago

good work dude. keep it up.

Manas 4 years ago

good

rvavuleri 4 years ago

keep it up. Good work

Nagesh 4 years ago

Pls do the same. Its very good one

rayanthomos 4 years ago

Great!!!

Suhaib 4 years ago

It is really good.

clickbankformula profile image

clickbankformula 4 years ago

thanks for the great tips

Ramya Selvi 4 years ago

It was very useful to me.. Great Thanks... Keep it Up !!!!!!

githa 3 years ago

try to present more example programs in which we have to find errors

santhosh tadavai 3 years ago

really helpfullll...n also referred to my fnds....appreciate the gud work...thnx again...

deepak sony 3 years ago

its really very knowledgeable site. thanks for everyone to share the knowledge.

regards,

Deepak Sony

vinay 3 years ago

thanks .keep on doing

Asha 3 years ago

Good one..

suman 3 years ago

Nice but this are very basic q&A i want some new Q regarding oracle11i

.

rpatel 3 years ago

Gr8 Interview Q&As. Very helpful..

Nagaraj 3 years ago

Brilliant, Keep in up with some more Advanced Q and Pl/SQL enhancements in 11g.

Keshava 3 years ago

I am Keshava. Found Q&A were very useful. Good one. Keep it up.

Raj 3 years ago

Very good questions with precise and tougtful answers! Nice work.

Sam 2 years ago

Thanks a lot Rakesh !!

sreekanth 2 years ago

this is good...i am learning new things

Mira 2 years ago

This is really good question answer its gonna help me Thank you

nandu 2 years ago

hey u have done a good job.happy to c people like you

Praveena 2 years ago

Good and Great Efforts.

P. K Roy 2 years ago

It's very very essential for us.

Raj Yadav 2 years ago

Excellent dude!!

Manoj 2 years ago

Great work man..keep it up.

pinky 2 years ago

Post more number of questions....

Anyhow this is very useful.......

Phani 2 years ago

Very useful.. Thanks!!

lakshmi 2 years ago

its very use full...thanks

mmm 2 years ago

very good

Santha 24 months ago

Excellent information... thank you.

Suresh 23 months ago

This is Really to start of my refresh.

Baijnath Verma 22 months ago

Thanks for Everyone

Satish Chauhan 22 months ago

Many Many Thanks !!

vinni 22 months ago

VERY USEFUL.. THANX A LOT!!! POST MORE NUMBER OF QUESTIONS AND ANS....

raj kumar 22 months ago

Very goood info.

Nandini 22 months ago

nice

thulasi 22 months ago

it is very helpful for the guys who has basic knowledge but not in depth.thanks a lot.keep doing the same .thanq

ovais 20 months ago

Very uselfull for basic review

Vijay 19 months ago

Gr8...

M.A.Anwar 19 months ago

Interesting and useful technical information . Thanks.

dipti_s 17 months ago

The questions are helpful to me..thanks a lot!!!

karthik 16 months ago

Its nice.Already I finished ocp exam its used for recalling everyone totally nice!!!!!!1

Yogesh N. Patil 15 months ago

Good work to explore intermediate Oracle Professionals... Thanks !!

Usha 14 months ago

Its really good

abc 13 months ago

nice job

Nagender 12 months ago

add few more basic questions..

good answers & thanks for your work

siddique rahman 9 months ago

good answers..we have very useful for ur answers..thank u

mahesh 8 months ago

it's good for improving knowledge.

Thanks

Satish T 8 months ago

Good work man..Thanks for sharing

Farooque 8 months ago

its very usefull

kksai 7 months ago

found the questions n answers very useful.

Thankyou for posting them.

Sam 6 months ago

Thanks a lot.Questions are really useful

Vijay Battula 6 months ago

Excellent

Benjamine 5 months ago

Really very good questions and answers.

Sharad Raj Kushwaha 4 months ago

thnx to guide

Avinash 4 months ago

Its good

rincy 4 months ago

Thanks.........

sandhya 4 months ago

very good question gallery...

pbd 4 months ago

thanks.. Pls post especially Objects & advanced plsql related questions..

Arrry 3 months ago

Thanks...

Merin Philip 3 months ago

NICE YA

Muhd.Aarif 3 months ago

Really awesome......impressing,keep it up

Rakesh (Oracle OCP) 3 months ago

Awesome information!!! Thanks!

Drashti 3 months ago

nice thanks for sharing.please add some other important question and answers for interview.

Abdul Gafoor 3 months ago

Superb...

Rajendra 3 months ago

thanks a lot

sandeep 2 months ago

fine..

Gopal 2 months ago

Can anyone help me with PL-SQL interview questions. I mean actual working environment questions, as to what tools are used in everyday PL/SQL work and what happens after every step of coding etc. Thanks

Gopal

gopalseri@gmail.com

srinivas 2 months ago

good.. useful data for us....

Neha 4 weeks ago

Excellent !!

Tapas 4 weeks ago

great..

uma 3 weeks ago

good

phani 13 days ago

nice tips

Submit a Comment
Members and Guests

Sign in or sign up and post using a hubpages account.



    • No HTML is allowed in comments, but URLs will be hyperlinked
    • Comments are not for promoting your Hubs or other sites

    Please wait working