%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
Renaming Columns - SQL SQL has no direct counterpart of RENAME. To derive the table on the right in Figure 4.4 from the table on the left, Tutorial D has IS_CALLED RENAME ( St

Example of NOT EXISTS in SQL Example: Use of NOT EXISTS CREATE ASSERTION Must_be_enrolled_to_take_exam_alternative1 CHECK ( NOT EXISTS (SELECT StudentId, CourseId

SQL Is a Database Language: The commands given to a DBMS by an application are written in the database language of the DBMS. The term data sublanguage is sometimes used instea

Question: (a) The objective of query optimization is to choose the most efficient strategy for implementing a given relational query, thereby improving the system performance. On

Architecture The PL/SQL run-time system and compilation is a technology, not an independent product. Consider this technology as an engine that compiles and executes the PL/SQL

Using the FORALL Statement The keyword FORALL instruct the PL/SQL engine to bulk-bind input collections before sending them all to the SQL engine. Though the FORALL statement

Count Operator in SQL Example: Counting the students who have scored more than 50 in some exam (SELECT COUNT (*) FROM (SELECT DISTINCT StudentId FROM EXAM_MARK WHE

Other monadic - SQL In 2VL there are just 4 (2 2 ) monadic operators, of which negation is really the only "useful" one. When a third truth value is introduced we have 27 (3 3

Example of WRAP Operator - SQL The effect of Example can be obtained in SQL but note that one needs to write down not only the names of the columns being wrapped but also the

Disjunction (OR, ∨) Again we have nine rows instead of just four and again, when unknown is not involved, the rows are as for 2VL. Also, when anything is paired with true, t