Quantcast
OracleBrains.Com header image 2

Understanding NO_DATA_FOUND

December 25th, 2006 by Rajender Singh · No Comments

I find Difference between %NOTFOUND & NO_DATA_FOUND. post by S. Inderjeet Singh quite interesting.

So I decided to research on it and contribute towards it.

NO_DATA_FOUND is not only related to a table in database. In fact it is raised under following condition:

1. An Implicit query returns not data.

2. An attempt is made to refer a row in a PL/SQL table which has not been defined.

3. Attempt is made by built-in packages of Oracle Tools to read the operating system file past its end.

Best thing about NO_DATA_FOUND exceptions is that it is not a reserved word exception and matter of fact is an expection that is declared in package named “STANDARD” in SYS schema as follows:

NO_DATA_FOUND exception;
pragma EXCEPTION_INIT(NO_DATA_FOUND, 100);

In reality this condition is not an error but a situation where we are trying to read which no more exist. In SQL and PL/SQL point of view this is not an error.

But due to default package STANDARD, it is treated as an exception.

Note: There are two default packages related to PL/SQL one is STANDARD and other is DBMS_STANDARD.


Tags: SQL and PL/SQL

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Comment moderation is enabled. Your comment may take some time to appear.