Handling invalid identifier exception in plsql [message #663542] |
Wed, 07 June 2017 10:35 |
|
ynkr999
Messages: 7 Registered: May 2017
|
Junior Member |
|
|
Hi Gazzag,
ERROR at line 6:
ORA-06550: line 6, column 13:
PL/SQL: ORA-00904: "ASD": invalid identifier
ORA-06550: line 4, column 1:
PL/SQL: SQL Statement ignored
i am getting above error in my plsql code.i want to hadle this error in exception block.is it possible to handle in exception block.
the following is my code.if any mistake is there please correct me.
DECLARE
v_ename VARCHAR2(20);
invalid_identifier_exception1 EXCEPTION;
PRAGMA EXCEPTION_INIT (invalid_identifier_exception, -06550);
BEGIN
SELECT ename
INTO v_ename
FROM emp
WHERE empno = &v_empno;
EXCEPTION
WHEN no_data_found THEN
dbms_output.Put_line('this number does not exist with any employee');
WHEN invalid_number THEN
dbms_output.Put_line('please enter valid number');
WHEN invalid_identifier_exception1 THEN
dbms_output.Put_line ('Unexpected error');
WHEN OTHERS THEN
dbms_output.Put_line('please contact your administrator');
END;
Enter value for v_empno: uiy
old 8: where empno=&v_empno;
new 8: where empno=uiy;
PRAGMA EXCEPTION_INIT (invalid_identifier_exception, -06550);
*
ERROR at line 4:
ORA-06550: line 4, column 24:
PLS-00109: unknown exception name 'INVALID_IDENTIFIER_EXCEPTION' in PRAGMA EXCEPTION_INIT
*BlackSwan added {code} tags. Please do so yourself in the future.
How to use {code} tags and make your code easier to read
*LF fixed topic title typo
[Updated on: Wed, 07 June 2017 13:14] by Moderator Report message to a moderator
|
|
|
|
|
|
|
|
|