Solved

Disable No_Data_Found Exception in Pl-SQL block

Posted on 2014-07-19
6
661 Views
Last Modified: 2014-07-21
Hi,

In my Pl-SQL block there are 20 different SELECT queries extracting data from different tables.  And the requirement is that all queries are independent to each other, means that if any SQL statement gives error the procedure should continue for next SELECT statement instead of STOPPING procedure at EXCEPTION level.  I know that we can use BEGIN and END for each independent query to call its own EXCEPTION block.  But is there any way to disable NO__DATA_FOUND exception for the said PL/SQL block so all the queries run continuously without using their separate BEGIN and END block.

Thanks and Regards,
0
Comment
Question by:Sudees
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 38

Accepted Solution

by:
Gerwin Jansen, EE MVE earned 300 total points
ID: 40207222
You could try adding a dummy column at the end of each select that selects some string from dual. That way you always get a record from the select (but filled with one or more NULLs).

Like this:

before: select a,b,c from d;
after: select a,b,c, (select 'some_string' d from dual) from d;
0
 
LVL 77

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 100 total points
ID: 40207982
Nested pl/sql blocks with their own exception handler is the correct way to do this.
0
 

Author Comment

by:Sudees
ID: 40207983
Yes, I know about that but the queries are too much so NESTED pl/sql block makes the code complex so I want to ask, if there is any way to disable any exception in PL/SQL block
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 40207997
I do not know of a way to disable exceptions for an entire block of code.

I feel you will either need to edit the code and do things the way they are supposed to be done or edit the selects as suggested above so they always return something.
0
 
LVL 16

Assisted Solution

by:Wasim Akram Shaik
Wasim Akram Shaik earned 100 total points
ID: 40208248
One way is to go for the count..

first count the record set output of the query, if its greater than 0(obviously if 0 means no data found) then you can execute the query..

But here you have to write a statement again which is simply a duplicate of actual query where in its just checking the count.

as experts suggested.. nested pl/sql blocks are the efficient way to do this..
0
 

Author Closing Comment

by:Sudees
ID: 40209416
Thanks for your suggestions..
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

697 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question