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 -> Simple Create Trigger Problem

Simple Create Trigger Problem

From: <arijitchatterjee123_at_yahoo.co.in>
Date: 13 Dec 2004 20:55:35 -0800
Message-ID: <1103000135.516627.56760@f14g2000cwb.googlegroups.com>


Dear Faculties,
Once again I am disturbing you.I am explaining the scenario. I am two tables, tab1 and tab1Copy.



create table tab1
(
name varchar2(10),
amount number
);

create table tab1Copy
(
name varchar2(10),
amount number,
SumAmount number
);



I have created a trigger TRG_TAB1 on tab1,Whenever any new entry taking place that should insert the same in tab1copy table

CREATE OR REPLACE TRIGGER TRG_TAB1
AFTER INSERT OR UPDATE OR DELETE
ON TAB1 FOR EACH ROW
BEGIN
IF INSERTING THEN
DBMS_OUTPUT.PUT_LINE(:NEW.NAME );
EXECUTE IMMEDIATE 'INSERT INTO TAB1COPY(NAME,AMOUNT) VALUES('||:NEW.NAME ||','|| :NEW.AMOUNT ||')'; EXECUTE IMMEDIATE 'UPDATE TAB1COPY SET SUMAMOUNT=0 WHERE NAME='|| :NEW.NAME ;
COMMIT; END IF; END;

But I am getting the error at the time of insertion.

SQL> INSERT INTO tab1(NAME,AMOUNT) VALUES('ARIJIT',100); INSERT INTO tab1(NAME,AMOUNT) VALUES('ARIJIT',100) *
ERROR at line 1:
ORA-00984: column not allowed here
ORA-06512: at "SCOTT.TRG_TAB1", line 4
ORA-04088: error during execution of trigger 'SCOTT.TRG_TAB1'

----------------------------------------
Please help me out.

Thanks in advance
Regards
Arijit Chatterjee Received on Mon Dec 13 2004 - 22:55:35 CST

Original text of this message

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