What are cursors, exceptions, stored procedures
Share
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Cursor- A SELECT statement can be used if the query returns exactly one row. To handle a query that can return an arbitrary number of rows, PL/SQL uses cursors to allow the rows of a query result to be accessed one at a time. The cursor can be advanced by one to access the next row.
A cursor must be
• declared and opened before it can be used
• closed to deactivate it after it is no longer required
Once the cursor has been opened, the rows of the query result can be retrieved one at a time using a FETCH statement.
Exceptions:
An exception is an identifier in PL/SQL raised during the execution of a block that terminates its main body of actions, although some final actions can be performed.
An exception can be raised automatically or explicitly using the RAISE statement
To handle raised exceptions, separate routines called exception handlers are specified.
The exception handler itself is defined at the end of the PL/SQL block.
Stored Procedures:
Sub program in PL/SQL that can take parameter and be invoked. They can modify and return data passed to them as a parameter.
A stored procedure is a subroutine available to applications that access a relational database management system (RDBMS). Such procedures are stored in the database data dictionary.
Typical uses for stored procedures include data-validation (integrated into the database) or access-control mechanisms.