Partial preview of the text
Download It is about mathematics for every student who want to study mathematics and want to grab and more Schemes and Mind Maps Commercial Law in PDF only on Docsity!
Experiment no: - 5 Objective: - Creating cursor Theory:- A cursor is a pointer to this context area. PL/SQL controls the context area lhrough a cursor. A cursor holds the rows (one or more) returned by a SQL statement. The set of rows the cursor holds is referred to as the active set. You can name a cursor so that it could be referred to in a program to fetch and process the rows returned by the SQL statement, one at a time. There are two types of cursors - = Implicit cursors. « Explicit cursors Implicit Cursors Implicit cursers are automatically created by Oracle whenever an SQL statement |s executed, when there is no explicit cursor for the statement. Programmers cannot conirol the implicit cursors and the information in it. Whenever a DML statement (INSERT, UPDATE and DELETE) is issued, an implicit cursor is associated with this statement. For INSERT operations, the cursor holds the data thal needs to be inserted, For UPDATE and DELETE operations, the cursor identifies the rows thal would be affected. In PL/SQL, we can refer to the most recent implicit cursor as the SQL cursor, which always has attribules such as %FOUND, “ISOPEN, %NOTFOUND, and %ROWCOUNT. The SQL cursor has additional attributes, %BULK_ROWCOUNT and %BULK_EXCEPTIONS, designed for use wilh Ihe FORALL statement. The following table provides the description of the most used attributes - S.No Attribute & Description %FOUND 1 Returns TRUE if an INSERT, UPDATE, or DELETE statement affected one or more rows of a SELECT INTO statement returned one or more rows. Otherwise, it returns FALSE. %NOTFOUND 2 The logical opposite of %FOUND. It returns TRUE if an INSERT, UPDATE, or DELETE statement affected no rows, or a SELECT INTO statement returned no rows. Otherwise, it returns FALSE.