PL/SQL   «Prev 

PL/SQL Cursor Block

The central purpose of the Oracle PL/SQL language is to make it as easy and efficient as possible to query and change the contents of tables in a database. You must use the SQL language to access tables, and each time you do so, you use a cursor to execute your task.
Question:What is a cursor?
A cursor
  1. is a pointer to a private SQL area that stores information about the processing of a SELECT or
  2. (DML)data manipulation language statement (INSERT, UPDATE, DELETE, or MERGE).
Cursor management of DML statements is handled by Oracle Database, but PL/SQL offers several ways to define and manipulate cursors to execute SELECT statements.

1) Within the DECLARE section, the cursor and the variables are defined.. Defining a PL/SQL cursor that queries an object table is very similar to defining a PL/SQL cursor that queries a relational table.

FOR see_all_date IN get_all_date LOOP
  dbms_output.put_line( The Customer
  '|| see_all_dat.firstname||'
  '||see_all_data.Lastname|| 'reside in 
  '||||' ,
For signals the beginning of the FOR Loop. After retrieving

END signals closing of the cursor after data processing is complete