Oracle uses implicit cursors for its internal processing. Even if we execute a SELECT statement Oracle reserves a private SQL area in memory called cursor.
We update the employee 'Mitesh' department is update to 'Program Developer'.
Example Code:
Emp Table
EMP_NO
EMP_NAME
EMP_DEPT
EMP_SALARY
1
...
Thursday, September 13, 2012
Monday, September 10, 2012
Explicit Cursor
Explicit Cursor which declared by user are called Explicit Cursor. User is declare and open the cursor to reserve
the memory and fetch the populated data from the active data set one at a time, and last close the cursor.
Step for Using Explicit Cursor
Declare Cursor
Open Cursor
Loop
Fetch Record into Cursor
Exit Loop
Close Cursor
Explicit...
Example Of Explicit Cursor
%ROWCOUNT and %NOTFOUND: Example
This Example retrieves the first 5 employees one by one. This example shows how
%ROWCOUNT and %NOTFOUND attributes can be used for exit conditions in a loop.
SET SERVEROUTPUT ON
DECLARE
empno employees.employee_id%TYPE;
ename employees.last_name%TYPE;
...
Examples Of implicit cursor
What is implicit cursor in Oracle? -
A session contains a single implicit cursor which is defined automatically by PL/SQL.
The cursor gets assigned to represent the execution of a statement whenever it is executed.
Following are the attributes of the implicit cursor:
Attribute ...
Cursors with Parameters
Cursors with Parameters
You can pass parameters to a cursor in a cursor FOR loop. This means that you can open and close an
explicit cursor several times in a block, returning a different active set on each occasion. For each
execution, the previous cursor is closed and reopened with a new set of parameters.
Each formal parameter in the cursor...
What is a Cursor ?
What is a Cursor ?
A cursor is a pointer to the private memory area allocated by the Oracle server.
There are two types of cursors:
Implicit: Created and managed internally by the Oracle server to process SQL statements
Explicit: Explicitly declared by the programmer
The Oracle server allocates a private memory area called the context area for...
Saturday, September 1, 2012
Loops In Pl-Sql
Iterative
Statements in PL/SQL
An iterative control Statements are used when we want to repeat the execution
of one or more statements for specified number of times. These are similar to
those in
There are three types of loops in
PL/SQL:
• Simple Loop
• While Loop
• For Loop
1)
Simple Loop
A
Simple Loop is used when a set of statements...