(Paper) Class XII Informatics Practices: Chapter Wise Papers (CURSORS AND TRIGGERS)

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

Class XII Informatics Practices Paper (Chapter Wise With Answer)


CURSORS AND TRIGGERS

Q1. a)What is a cursor? What types of cursors are supported in PL/SQL? Explain Cursor attributes.
b)What is the purpose of cursor in PL/SQL? Name the types of cursors used in PL/SQL? Explain Cursor attributes.
c)What is the importance of cursor for loop? How it simplifies the operation? Explain with suitable example.

Answers:
(a) The oracle uses a work area of memory to execute SQL statements. This work area is also called context area and data stored in this context area is called the Active Data Set. A cursor is a pointer to this context area.

Types of cursors:
There are two types of cursors: (i) Implicit Cursor (ii) Explicit Cursor
Implicit Cursor The oracle implicitly (internally or automatically) opens a cursor for each SQL statement. Since the implicit cursors are opened and managed by oracle internally. So there is no need to open and manage the cursors by the user. Implicit cursor attributes can be used to access information about status of last insert, update, delete or single row select statement.

Explicit Cursor When individual records in a table have to be processed inside a PL/SQL code block a cursor is used. This cursor will be declared and mapped to an SQL query in the Declare Section of the PL/SQL block and used within the Executable Section. This cursor needs to be opened before the reading of the rows can be done, after which the cursor is closed. Cursor marks the current position in an active set. A cursor thus created and used is known as an Explicit Cursor.

Download Full Paper Here!