Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Help me with Triggers Please!!
Ricky,
there are two problems with the trigger.
1.) This is an insert trigger, therefore you should not attempt to insert rows
into the same table that the insert trigger is processing. i.e insert into studentdb values(studentdb.stuid); 2.) You could try a row level trigger. With a row level trigger, you have access to all of the column values. To access a column value you would prefix it with :new. ex:
CREATE OR REPLACE trigger ricky
before insert on studentdb for each row
DECLARE
dumstudent char(3);
begin
insert into temptable values(:new.stuid); end;
Ricky <rforde_at_sangacorp.com> wrote in article
<33CF7F57.AFB8F22B_at_sangacorp.com>...
> 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.
>
>
Received on Fri Jul 18 1997 - 00:00:00 CDT