Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Handling ORA-06550 thru exceptions

926062Mar 23 2012 — edited Mar 23 2012
Hello,

I am new to Oracle and I was looking for an answer for a similar problem that I was facing and landed on to this link. I hope you will guide me thru this.
I am writing a procedure to insert data to a table. My procedure works fine but I am not able to get the Exceptions run.
I was trying to supress the error ORA-06550 thru PRAGMA EXCEPTION_INIT so that if less or wrong parameters are passed to the procedure then instead of an Oracle I would provide my own error statement.

I have coded something like this:

create or replace PROCEDURE emp_insert (....parameters....)
inv_data EXCEPTION;
PRAGMA EXCEPTION_INIT(inv_data, -06550);
begin
:
:
EXCEPTION
When inv_data then
dbms_output.put_line('xxxxxxx')
END emp_insert;

But even after this I am getting the Oracle error statments when I pass wrong parameters:
EXECUTE emp_insert('ABC',NULL)
Error report:
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'EMP_INSERT'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:

Am I handling the exception correctly?
If not, is there any other way to supress this error.

I would really appreciate your help on this.

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 20 2012
Added on Mar 23 2012
3 comments
2,363 views