%notfound - explicit cursor attributes, PL-SQL Programming

%NOTFOUND

The %NOTFOUND is logical, opposite of the %FOUND. The %NOTFOUND yields FALSE if the last fetch returned a row, or TRUE when the final fetch failed to return a row. In the illustration below, you use the %NOTFOUND to exit a loop if FETCH fails to return a row:

LOOP

FETCH c1 INTO my_ename, my_sal, my_hiredate;

EXIT WHEN c1%NOTFOUND;

...

END LOOP;

Before the first fetch, the %NOTFOUND evaluates to NULL. Therefore, if FETCH never executes effectively, the loop is never existed. That is as the EXIT WHEN statement executes only if it's WHEN condition is true. To be secure, you might want to use the EXIT statement below instead:

EXIT WHEN c1%NOTFOUND OR ci%NOTFOUND IS NULL;

When a cursor or cursor variable is not open, referencing it with the %NOTFOUND raises

INVALID_CURSOR.

Posted Date: 10/4/2012 4:11:04 AM | Location : United States







Related Discussions:- %notfound - explicit cursor attributes, Assignment Help, Ask Question on %notfound - explicit cursor attributes, Get Answer, Expert's Help, %notfound - explicit cursor attributes Discussions

Write discussion on %notfound - explicit cursor attributes
Your posts are moderated
Related Questions
User-Defined Exceptions The PL/SQL defines the exceptions of your own. Dissimilar to the predefined exceptions, the user-defined exceptions should be declared and should be rai

Using a Join on 2 tables, select all columns and all rows from the tables without the use of a Cartesian product. Query: SELECT * FROM EMPLOYEE1 JOIN CONTRACT ON EMPLOYEE

Project Description: This is stage 1 of a larger conversion project. We are converting a traditional Server/Client application written in Access 2007 into a web interface with S

Package Specification The package specifications contain the public declarations. The scopes of these declarations are local to your database representation and global to the

Write an anonymous block that contains a PL/SQL procedure. The procedure takes two input parameter: oldZip and newZip, and it updates the zipcodes table by replacing all oldZip wit

Relational Operators and Logical Operators It prepares the ground for subsequent sections in which each specific relational operator is paired with its logical counterpart, su

LEVEL You use the LEVEL with the SELECT CONNECT BY statement to categorize rows from a database table into a tree structure. The LEVEL returns the level number of a node in a

Project Description: I have two types of data sources. One that is a list in SharePoint and another that is an access desktop database. The access desktop database is fairly com

Write a stored procedure that accepts the post code in which the customer resides as the input parameter. The procedure should then use an explicit cursor to display comprehensive

Type versus Representation Confusion in SQL This describes how a value might have two or more distinct representations. For example, user-defined type POINT might have a decla