%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
Deleting Objects You can use the DELETE statement to eradicate objects from an object table. To eradicate objects selectively, you use the WHERE clause, as shown below: BEG

Synonyms You can create the synonyms to provide location transparency for the remote schema objects like tables, views, sequences, stand-alone subprograms, and packages. Though,

Declaring Objects: You can use the object types wherever built-in types like CHAR or NUMBER can be used. In the block below, you can declare object r of type Rational. Then, yo

Keyword & Parameter Description: WHEN: This keyword introduces the exception handler. You can have many exceptions execute the similar sequence of the statements by follo

Identifiers You use identifiers to name the PL/SQL program items and units that include constants, variables, cursors, exceptions, cursor variables, subprograms, and packages.

Aggregate Assignment The %ROWTYPE declaration cannot include an initialization clause. Though, there are two ways to assign values to all fields in a record at once. At First, t

SELECT INTO Statement   The SELECT INTO statement retrieve data from one or more database tables, and then assigns the selected values to the variables or fields. Syntax:

%NOTFOUND The %NOTFOUND is the logical opposite of the %FOUND. The %NOTFOUND yields TRUE when an INSERT, UPDATE, or DELETE statement affected no rows, or the SELECT INTO state

Parameter & Keyword Description: function_name: The user-defined function is identifying by that keyword. parameter_name: This identifies the formal parameter that

Authorize and fetch data from Instagram Project Description: Incorporate Instagram feed on mobile site platform: c#, ms sql, jquerymobile, jquery Web admin Author