Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

What is the difference between an aggregate and an analytic function?

I'm lookin
g for them knowing that a sum aggregate (or any other aggregate function) will r
eturn one row for a group and a sum analytic will return one result for each row
in the group. If they mention the "Window", they get a bonus point. ;-)

How do you create a hierarchical query? Connect by.

How would you generate XML from a query? The answer here is "A lot of different
ways". They should know that there are SQL functions: XMLELEMENT, XMLFOREST, etc
and PL/SQL functions: DBMS_XMLGEN, DBMS_XMLQUERY, etc.

What do you need before implementing a member function? You need to create a typ
e.

How do you tune a query? I'm looking for a discussion of autotrace and/or explai
n plan. Ask them what they're looking for in a plan. This should not be a single
sentence. Look for a comfort level.
What is the default value of a boolean? NULL. This is somewhat tricky but appare
ntly there are languages that default boolean to false. A PL/SQL developer needs
to know all variables default to NULL.

Why is using implicit conversions a poor programming practice? For dates, you mu
st ASSUME that the default date format will always be the same (and it won't be)
. In some cases, implicit conversion is slower. I want to feel like they don't b
elieve writing to_char or to_number is more work than it's worth. BTW, this also
applies to SQL.

How can you tell if an UPDATE updated no rows? SQL%NOTFOUND.

How can you tell if a SELECT returned no rows. NO_DATA_FOUND exception.

How do you run Native Dynamic SQL? Execute immediate.

What is an autonomous transaction? Identified by pragma autonomous. A child tran


saction separate from the parent that MUST be committed or rolled back.
How can you find within a PL/SQL block, if a cursor is open?
Expected answer: Use the %ISOPEN cursor status variable.
What are the types of triggers?
Expected Answer: There are 12 types of triggers in PL/SQL that consist of
combinations of the BEFORE, AFTER, ROW, TABLE, INSERT, UPDATE, DELETE and
ALL key words:
BEFORE ALL ROW INSERT
AFTER ALL ROW INSERT
BEFORE INSERT
AFTER INSERT etc.
Describe the use of %ROWTYPE and %TYPE in PL/SQL
Level: Low
Expected answer: %ROWTYPE allows you to associate a variable with an entire tabl
e row.
The %TYPE associates a variable with a single column type.
What is a mutating table error and how can you get around it?
Level: Intermediate
Expected answer: This happens with triggers. It occurs because the trigger is tr
ying to update a row it is currently using. The usual fix involves either use of
views or temporary tables so the database is selecting from one while updating
the other.

You might also like