5.2 PLSQL Chapter 5 PDF
5.2 PLSQL Chapter 5 PDF
Cursors
Implicit Cursors
Explicit Cursors
Declaring the cursor defines the cursor with a name and the
associated SELECT statement.
For example −
Opening the cursor allocates the memory for the cursor and makes
it ready for fetching the rows returned by the SQL statement into it.
For example, we will open the above defined cursor as follows −
OPEN c_customers;
CLOSE c_customers;
Example
DECLARE
c_id customers.id%type;
c_name customerS.No.ame%type;
c_addr customers.address%type;
CURSOR c_customers is
SELECT id, name, address FROM customers;
BEGIN
OPEN c_customers;
LOOP
FETCH c_customers into c_id, c_name, c_addr;
EXIT WHEN c_customers%notfound;
dbms_output.put_line(c_id || ' ' || c_name || ' ' || c_addr);
END LOOP;
CLOSE c_customers; END; /
ConClusion
In this chapter, we explained about Cursors, types of cursors,
example of types of cursor and different uses of cursors in
application.