Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Are Triggers Really that Bad or ....???
Hi,
I tried playing around with the idea of reducing the amount of work needed to automate the process of creating triggers for all the tables and this is what i came up with
select 'Create or replace Trigger '||table_name||'_Trigger BEFORE INSERT OR
UPDATE ON '||
table_name||' for each row BEGIN IF inserting THEN
:NEW.created_date:=sysdate; :NEW.created_by:=user; END IF; If Updating
then :NEW.updated_date:=sysdate; :NEW.updated_by:=user; end if; END; /'
from dba_tab_columns where column_name='CREATED_DATE'
I spool the above query into a file and execute it.
It would work fine , but the only problem is the / at the end of the procedure it creates. The / should appear on the next line and I am not able to do so. Is there a way I can force a carriage return before the /.
If i manually edit the output of the above query so that the / appears on the next line of each result set, it works great.
Please suggest
Thanks
Ronnie
Received on Wed Aug 14 2002 - 15:16:57 CDT