Reputation: 337
I am creating a package and after that I am doing a prompt to create a trigger on a table which will check old values and new values:
set serveroutput on
set LIN 200
set feedback off
set verify off
set embedded on
set heading off
spool tmp.sql
prompt create or replace trigger aud_&1
prompt after update on &1
prompt for each row
prompt begin
select ' audit_pkg.check_val( ''&1'', ''' || column_name || ''', ' || ':new.' || column_name || ', :old.' || column_name || ');'
from user_tab_columns where table_name = upper('&1')
/
prompt end;
prompt /
spool off
set feedback on
set embedded off
set heading on
set verify on
@tmp
-------------
But when I run the script it always compiles with an error:
All it means is that it misses out the ;
after end:
So my question is what do I need to add to my script to include the required ;
and yes of course I have tried a few things myself such as adding ;;
on line 95 but nothing works.
Upvotes: 1
Views: 1345
Reputation: 17268
Proceed analogously to the generation of the plsql calls inside your script. Instead of
prompt end;
write
select 'end;' from dual
/
Upvotes: 2