Handling ORA-06550 thru exceptions
926062Mar 23 2012 — edited Mar 23 2012Hello,
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