How to catch PL/SQL: ORA-00904 error?
Hi ,
I am trying to run the following PL/SQL Block and have trapped error code -904( for invalid column name) in the exception section block.
The column name in the select query does not exist in the emp table and as per my understanding since I have an exceptiion handler for this error it should be handled in Exception Block.
DECLARE
invalid_column exception;
pragma exception_init (invalid_column,-00904);
no number;
BEGIN
select empn into no from emp
where ename='king';
EXCEPTION
when invalid_column then
dbms_output.put_line(Column ane does not exist)
);
end;
/
1) Can You please let me know why this is not getting caught in Exception handler
*2) What changes should I make in Exception handler section so that Invalid column name is handled in the program*
Thanks and regards
Harmeet