There are two types of cursors in PL/SQL. Implicit cursor, and explicit cursor
PL/SQL Interview Questions
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 …
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 …
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.
With SAVEPOINT, only part of transaction can be undone.
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.
Following conditions are true for the Commit statement: Other users can see the data changes made by the transaction. The locks acquired by the transaction are released. The work done by the transaction becomes permanent.
A syntax error can be easily detected by a PL/SQL compiler. For example: incorrect spelling etc. while, a runtime error is handled with the help of exception-handling section in a PL/SQL block. For example: SELECT INTO statement, which does not return any rows.
%ISOPEN: it checks whether the cursor is open or not. %ROWCOUNT: returns the number of rows affected by DML operations: INSERT,DELETE,UPDATE,SELECT. %FOUND: it checks whether cursor has fetched any row. If yes – TRUE. %NOTFOUND: it checks whether cursor has fetched any row. If no – TRUE.
Modularity, extensibility, reusability, Maintainability and one time compilation.