Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Are Triggers Really that Bad or ....???

Re: Are Triggers Really that Bad or ....???

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Wed, 14 Aug 2002 22:50:06 +0200
Message-ID: <ligllu0luf0rc7niorvnv7p3a5pm52b6fd@4ax.com>


On Wed, 14 Aug 2002 16:16:57 -0400, "Ronnie Yours" <ronnie_yours_at_yahoo.com> wrote:

>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
>

simply use 'END;'||chr(10)||'/'
That should do it

Hth

Sybrand Bakker, Senior Oracle DBA

To reply remove -verwijderdit from my e-mail address Received on Wed Aug 14 2002 - 15:50:06 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US