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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Help me with Triggers Please!!

Re: Help me with Triggers Please!!

From: terryg8 <trg_at_ibm.net>
Date: 1997/07/20
Message-ID: <33D20EC9.5191@ibm.net>#1/1

Ricky wrote:
>
> I created this trigger to perform an insert on another table:
> CREATE OR REPLACE trigger ricky
> before insert on studentdb
> DECLARE
> dumstudent char(3);
> begin
> insert into studentdb values(studentdb.stuid);
> SELECT studentdb.stuid
> INTO dumstudent
> FROM studentdb;
> insert into temptable values(dumstudent);
> end;
>
> But this error keeps occurring when I do the insert on studentdb:
> insert into studentdb values('555')
> *
> ERROR at line 1:
> ORA-00984: column not allowed here
> ORA-06512: at line 4
> ORA-04088: error during execution of trigger 'SYSTEM.RICKY'
>
> By the way I'm using Personal Oracle 7.

You've inserting into the same table that the trigger is defined for. That's not permitted by Oracle, at least without kludging it.
I assume you were thinking that the trigger had to incorporate the actual DML statement for which it was written to fire? i.e. It's a before insert trigger so the trigger must include the insert statement? Not the case, the insert isn't required. If that's the wrong assumption, post more info on what you are trying to do.

Cheers,
Terry Received on Sun Jul 20 1997 - 00:00:00 CDT

Original text of this message

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