Friday, November 7, 2014

Answers for PL/SQL Questions.

Praise to GOD!!

You may find better answers for these if you browse through.  But to brush up before going to the interview, this may help you to remember in a faster way.  Please correct me if I had made any mistakes.

All the very best guys..

Please find the list of Capgemini PlSQL and Unix interview questions.

When they start to ask about what is cursor.  You mention what is cursor, and types of cursor, difference between them.

1.  What is Cursor,
Cursor means
CUrrent
Set
Of
Records.

The private SQL area which holds this Current set of records for processing a query for DML operations (INSERT, Update, Delete)

2.  Types of Cursor

Implicit and explicit cursors.

Implicit cursors are the select statements that are used to retrieve more than one row from the table/tables.  Where we don't explicitly specify the CURSOR keyword.

Whereas in Explicit cursor, we declare and define the cursor, we open the cursor, fetch the records, and process the records and close the cursor.

(Here they might ask you this question, what if, you don't close the cursor after the cursor is used.  Prepare for it as well)

They may ask you to define few types of attributes as CURSOR NOT FOUND, INVALID_CURSOR.


3.  What is trigger.
(Oracle definition)
Oracle lets you define procedures called triggers that run implicitly when an INSERTUPDATE, or DELETE statement is issued against the associated table or, in some cases, against a view, or when database system actions occur. These procedures can be written in PL/SQL or Java and stored in the database, or they can be written as C callouts.

Source:  http://docs.oracle.com/cd/B10500_01/server.920/a96524/c18trigs.htm

4.  Types of Triggers.
Source:  http://docs.oracle.com/cd/B10500_01/server.920/a96524/c18trigs.htm

5.  What is mutating error.

There are two exceptions to this recursion:
  • When a triggering statement modifies one table in a referential constraint (either the primary key or foreign key table), and a triggered statement modifies the other, only the triggering statement will check the integrity constraint. This allows row triggers to enhance referential integrity.
  • Statement triggers fired due to DELETE CASCADE and DELETE SET NULL are fired before and after the user DELETE statement, not before and after the individual enforcement statements. This prevents those statement triggers from encountering mutating errors.
6.  Is it possible to commit/Rollback inside a Function.  (If yes, how, if no, why?)
Search as Autonomous transaction

8.  How to add trailing zeros to numbers.
LPAD(). RPAD()

No comments:

Post a Comment