?
Solved

Disable No_Data_Found Exception in Pl-SQL block

Posted on 2014-07-19
6
Medium Priority
?
674 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 900 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 300 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 300 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

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!

Question has a verified solution.

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

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

764 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