Re: Trigger - Table Name - Generalise!

From: <rtproffitt_at_my-deja.com>
Date: Fri, 27 Aug 1999 23:50:54 GMT
Message-ID: <7q788s$bc0$1_at_nnrp1.deja.com>


Nandakumar,
You must write triggers for each table,
but you could do a couple of things to make your life easier.

  1. the generic part of the code could be put into a stored procedure and the triggers could all call the same procedure.
  2. If the trigger code is all identical except for the table name, you could generate a text file of dynamic sql in SQL/PLUS which would create all the trigger code for each table, like so: select 'create or replace trigger before... ..on '||TABLE_NAME||' for each row... etc, all the code.... /' from ALL_TABLES where .....etc.... Spool the results to file, then execute the file and all the triggers for all the tables would be created.

Robert Proffitt
Beckman Coulter
RTProffitt 'At' Beckman.com

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Sat Aug 28 1999 - 01:50:54 CEST

Original text of this message