Imp Oracle PLSQL Interview Questions
Imp Oracle PLSQL Interview Questions
I have taken more than 100 interviews for oracle plsql developer position and Below few set of questions i
asked in interviews.
RE: What is Pragma EXECPTION_INIT ? Explain...
Pragma exception_init Allow you to handle the Oracle predefined message by you'r own message. means you
can instruct compilertoassociatethe specific message to oracle predefined message at compile time.This way
you Improve the Readbility of your program,and handle it accoding to your own way.
It should be declare at the DECLARE section.
example
declare
salary number;
FOUND_NOTHING exception;
Pragma exception_init(FOUND_NOTHING ,100);
begin
select sal in to salaryfrom emp where ename ='ANURAG';
dbms_output.put_line(salary);
exception
WHEN FOUND_NOTHING THEN
dbms_output.put_line(SQLERRM);
end;
RE: What is Data Concarency and Consistency?
Concurrency
How well can multiple sessions access the same data simultaneously
Consistency
How consistent is the view of the data between and within multiple sessions, transactions or statements
According to O Reilly Book , the main difference between Index-By Table(pl-Sql Table) , Varray and nested
tables are Index-By Table
Nested Table
VARRAY
Dimensionality
Single
Single
Single
Usable in SQL?
No
Yes
Yes
Usable as column datatype in a table?
No
Yes; data stored "out of line" (in separate table)
Yes; data stored "in line" (in same table)
Uninitialized state
Empty (cannot be null); elements undefined
Atomically null; illegal to reference elements
Atomically null; illegal to reference elements
Initialization
Automatic, when declared
Via constructor, fetch, assignment
Via constructor, fetch, assignment
In PL/SQL, elements referenced via
BINARY_INTEGER
(-2,147,483,647 .. 2,147,483,647)
Positive integer between 1 and 2,147,483,647
Positive integer between 1 and 2,147,483,647
Sparse?
Yes
Initially, no; after deletions, yes
No
Bounded?
No
Can be extended
Yes
Can assign value to any element at any time?
Yes
No; may need to EXTEND first
No; may need to EXTEND first, and cannot EXTEND past upper bound
Means of extending
Assign value to element with a new subscript
Use built-in EXTEND procedure (or TRIM to condense), with no predefined maximum
EXTEND (or TRIM), but only up to declared maximum size
Can be compared for equality?
No
No
No
Retains ordering and subscripts when stored in and retrieved from database?
N/A
No
Yes
Used by Oracle to store information about various physical and logical Oracle structures e.g. Tables,
Tablespaces, datafiles, etc
28.What are the advantages of clusters ?
Access time reduced for joins.
29.What are the disadvantages of clusters ?
The time for Insert increases.
30.Can Long/Long RAW be clustered ?No.
31.Can null keys be entered in cluster index, normal index ?Yes.
32.Can Check constraint be used for self referential integrity ? How ?
Yes. In the CHECK condition for a column of a table, we can reference some other column of the same table
and thus enforce self referential integrity.
33.What are the min. extents allocated to a rollback extent ?
Two
34.What are the states of a rollback segment ? What is the difference between partly available and needs
recovery ?
The various states of a rollback segment are :ONLINE, OFFLINE, PARTLY AVAILABLE, NEEDS RECOVERY and
INVALID.
35.What is the difference between unique key and primary key ?
Unique key can be null; Primary key cannot be null.
36.An insert statement followed by a create table statement followed by rollback ? Will the rows be inserted
?
No.
37.Can you define multiple savepoints ?
Yes.
38.Can you Rollback to any savepoint ?Yes.
40.What is the maximum no. of columns a table can have ?
254.
41.What is the significance of the & and && operators in PL SQL ?
The & operator means that the PL SQL block requires user input for a variable. The && operator means that
the value of this variable should be the same as inputted by the user previously for this same variable.If a
transaction is very large, and the rollback segment is not able to hold the rollback information, then will the
transaction span across different rollback segments or will it terminate ?It will terminate (Please check ).
42.Can you pass a parameter to a cursor ?Explicit cursors can take parameters, as the example below shows.
A cursor parameter can appear in a query wherever a constant can appear. CURSOR c1 (median IN NUMBER)
ISSELECT job, ename FROM emp WHERE sal > median;
43.What are the various types of RollBack Segments ?
ublic Available to all instancesPrivate Available to specific instance
44.Can you use %RowCount as a parameter to a cursor ?Yes
45.Is the query below allowed :Select sal, ename Into x From emp Where ename = 'KING'(Where x is a record
2 comments:
MURLYB said...
May be I am not the right person to place this comment. For that excuse me, The questions and
answers are very useful. But I want to say that there is a small mistake in your first question
program. In your code you wrote that
"SELECT SAL IN TO SALARYFROM EMP WHERE ENAME='ANURAG' "
by seeing the about most of the people feel that the mistake is at SALARYFROM but the actual
mistake is at "IN TO".
Here INTO IS A CLAUSE if we give space between IN and TO the flavour will be missed.
More over this comment is not for you. because typos may occur at the time of typing.... THIS
COMMENT IS FOR THE BEGINNERS WHO ARE READING YOUR DATA.
February 6, 2015 at 6:41 AM
vergarasofia197@gmail.com said...
Tks very much for your post.
Avoid surprises interviews need preparation. Some questions come up time and time again
usually about you, your experience and the job itself. We've gathered together the most common
questions so you can get your preparation off to a flying start.