Home / Interview / PL/SQL :: General Questions

Interview :: PL/SQL

41) Explain the Rollback statement?

The Rollback statement is issued when the transaction ends. Following conditions are true for a Rollback statement:

  • The work done in a transition is undone as if it was never issued.
  • All locks acquired by transaction are released.
42) Explain the SAVEPOINT statement.

With SAVEPOINT, only part of transaction can be undone.

43) What is mutating table error?

Mutating table error is occurred when a trigger tries to update a row that it is currently using. It is fixed by using views or temporary tables.

44) What is consistency?

Consistency simply means that each user sees the consistent view of the data.

Consider an example: there are two users A and B. A transfers money to B's account. Here the changes are updated in A's account (debit) but until it will be updated to B's account (credit), till then other users can't see the debit of A's account. After the debit of A and credit of B, one can see the updates. That?s consistency.

45) What is cursor and why it is required?

A cursor is a temporary work area created in a system memory when an SQL statement is executed.

A cursor contains information on a select statement and the row of data accessed by it. This temporary work area stores the data retrieved from the database and manipulate this data. A cursor can hold more than one row, but can process only one row at a time. Cursor are required to process rows individually for queries.

46) How many types of cursors are available in PL/SQL?

There are two types of cursors in PL/SQL.

  1. Implicit cursor, and
  2. explicit cursor