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

Re: Simple Create Trigger Problem

From: DA Morgan <damorgan_at_x.washington.edu>
Date: Tue, 14 Dec 2004 16:16:24 -0800
Message-ID: <1103069672.76109@yasure>


arijitchatterjee123_at_yahoo.co.in wrote:

> 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

SELECT keyword
FROM v$reserved_words
WHERE keyword like 'NAM%';

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu
(replace 'x' with 'u' to respond)
Received on Tue Dec 14 2004 - 18:16:24 CST

Original text of this message

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