Interview :: PL/SQL
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.
With SAVEPOINT, only part of transaction can be undone.
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.
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.
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.
There are two types of cursors in PL/SQL.
- Implicit cursor, and
- explicit cursor