Posts

Showing posts from May, 2020

Important Exception Logic

--==================================================== Important example for exception --==================================================== --Redeclared Predefined Exceptions That is, declaring a user-defined exception name that is a predefined exception name --==================================================== --1 --==================================================== DECLARE V_NAME SCOTT . EMP . ENAME% TYPE; BEGIN insert into scott . emp ( empno , sal ) values ( 1234 , 'manoj' ); EXCEPTION WHEN INVALID_NUMBER THEN DBMS_OUTPUT.PUT_LINE ( 'your are tring to to insert wrong value ' ); WHEN OTHERS THEN dbms_output.put_line ( 'SQLCODE: ' || SQLCODE); dbms_output.put_line ( 'SQLERRM: ' || SQLERRM); END; --================= DECLARE V_NAME SCOTT . EMP . ENAME% TYPE; INVALID_NUMBER EXCEPTION; BEGIN insert into scott . emp ( empno , sal ) values ( 1234 , '