Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Automating Trigger creation for a table?
I created the script below to automate the process of creating a
universal trigger for a set of tables that I am loading. I keep getting
a bind variable "NEW" not declared error.
Any help would be appreciated!
SQL> get trigger.sql
1 Declare
2 cid INTEGER;
3 v_tablename Vchar2(10);
4 -- This procedure is used to create the trigger to preload the
ICOMS
5 -- NCR table.
6 procedure create_trigger (v_trigger_tablename Varchar2(10)) IS
7 BEGIN
8 CREATE OR REPLACE
9 TRIGGER PRELOAD_TRIGGER
10 BEFORE INSERT
11 ON v_trigger_tablename
12 FOR EACH ROW
13 BEGIN
14 SELECT seq_number_next.NEXTVAL INTO :new.seq_number FROM DUAL;
15 END;
16 END create_trigger;
17 -- Mainline Processing
18 BEGIN
19 -- Load the CBI0REP Table
20 v_tablename := 'cbi0rep'; 21 create_trigger(v_tablename);
![]() |
![]() |