Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How to handle errors in Stored Procedures.

Answer Posted / saraswathi muthuraman

If the procedure execution fails the oracle will quit the
execution with an error.

This error can be handled with in store procedure using
"exception".

declare
test_excep_name exception;
x number;
Begin
select emp_no into x from emp_test where emp_no=1;
If SQL%NOTFOUND then
raise test_excep_name;
end if;

exception
when test_excep_name then
dbms_output.put_line(' Error occurred during execution' || '
SQL error code is ' || sqlcode || ' SQL error maessage '||
sqlerrm);
when others then
dbms_output.put_line(' Error occurred during execution- This
is unknown error ' || ' SQL error code is ' || sqlcode || '
SQL error maessage '|| sqlerrm);
end;
/

Result :

Error occurred during execution- This is unknown error SQL
error code is 100
SQL error maessage ORA-01403: no data found

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is data compression?

938


How do you drop an index?

861


How to integrate the ssrs reports in application?

933


Why we use functions in sql server?

1010


What is simple indexing method?

969


How to test subquery results with the exists operator?

1032


On a windows server 2003 active – passive failover cluster, how do you find the node which is active?

1161


Explain timestamp datatype?

907


what are user defined datatypes and when you should go for them? : Sql server database administration

960


What is sleeping status in sql server?

980


How to check if a table is being used in sql server?

901


How to convert a table data in XML format in sql server?

2491


How many databases Microsoft SQL server provides?

1027


What is the Disadvantage of indexed sequential file.

1026


Why do you need a sql server?

1027