(E-Book) Class XII Informatics Practices : Chapter - II (Iteration And Cursors)

Disclaimer: This website is NOT associated with CBSE, for official website of CBSE visit - www.cbse.gov.in

Chapter – II

Iteration And Cursors

(Informatics Practices)


A cursor is a variable that can be used to access the result of a particular SQL query.

Cursors can move sequentially from row to row (cf. file pointers in C).

Every SQL query statement in PL/SQL has an implicit cursor.
It is also possible to declare and manipulate cursors explicitly:
    DECLARE
         CURSOR e IS
        SELECT * FROM Employees
        WHERE salary > 30000.00;
BEGIN

Cursors provide flexibility in processing rows of a query.
Simplest way to deal with a cursor is to loop over all rows using a FOR loop:
    DECLARE
        CURSOR e IS
        SELECT * FROM Employees
        WHERE salary > 30000.00;
    total INTEGER := 0;..................