please first replace dbms_output.put_line(sqlcode)
with
Raise_Application_Error(-20001,sqlcode)
now recompile you trigger.
insert a row into emp table
you will get error messages
it will also error line no where your Execute Immediate
command is given.
your are missing "Using" clause in Execute Immediate command.
In youor script, you are not getting any error regarding Excetion because you using Dbms_Output.Put_line command
which does not work for trigger. so use Raise_Application_Error() instead.
better use of Execute Immediate command is for
dynamic SQl statement
use can use this command in procedure to create a table.
see the example
SQL>DECLARE
BEGIN
EXECUTE IMMEDIATE 'CREATE TABLE T1 (T1 NUMBER)';
END;
PL/SQL procedure successfully completed.
SQL> DESC T1;
Name Null? Type
------------------------------- -------- ----
T1 NUMBER
Bookmarks