Akdora’s Blog

Programming, Oracle, Life, Fun

ORA-06508 PL/SQL: could not find program unit being called September 11, 2009

When you search this error on the net, you will find out these :

Cause: An attempt was made to call a stored program that could not be found. The program may have been dropped or incompatibly modified, or have compiled with errors.
Action: Check that all referenced programs, including their package bodies, exist and are compatible.

Yes, that’s true. But if you have lots of objects depends to a lot of object 🙂 You will need to more information to fix this error. If you face up with this error, you probably use SQLCODE and SQLERRM in your exception block of your PL/SQL code. Something  like this:

BEGIN
 NULL;
EXCEPTION
 WHEN OTHERS THEN
 ROLLBACK;
 INSERT_LOG(SQLCODE, SQLERRM);
END;

I do not advise to handle errors in this way. Because this error description does not give you enough information abour your error as ORA-06508 error. You don’t really know what triggered this exception. Operation of this code on a production database is also not easy. At this point, Oracle’s DBMS_UTILITY package will be included in out lives. 🙂

If you write something like this:

(more…)

Advertisements
 

Non-Predefined Exception Example February 5, 2009

Filed under: PL/SQL — Akdora @ 11:47 am
Tags: , , , ,

One of my friend asked me following question.

“I want to drop two columns of a table. So I wrote a basic drop command.

alter table t_test drop (col_name1, col_name2)

However, If this command is called more than once. I do not want an error message. What can I do for this?”

It’s a strange request, but this will learn us how to write a non-predefined  exception to solve this kind of requests. We can handle ORA-XXXXX exception as we want. We name them this numbered exceptions and handle them.  I will write a post about exception types as soon as possible. 

 When we try to drop a column that does not exists on the table. We get following error: ORA00904: invalid column name. It’s error number “-904”. We will use this number to define the exception.

(more…)