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

Tell me what are the advantages of using stored procedures?

1062


What are the differences between substr and charindex in sql server.

1185


Can you explain what is sql server english query?

1054


What is sql server english query?

1198


Is truncate autocommit?

993


What is tablesample?

1176


Please explain what is “asynchronous” communication in sql server service broker?

980


What are trace flags and mention a few common trace flags used with sql server?

1137


What is the optimization being performed in oracle and SQL Server?

1095


What is the use of RDBMS?

1055


What is indexing explain it with an example?

1070


What are the different authentication modes in sql server? How can it be changed?

1139


What are the different types of normalization?

1221


where can you add custom error messages to sql server? : Sql server administration

1172


How sql server enhances scalability of the database system?

1315