0

I am writing some PL/SQL code for a apex database application. With the code a want to realise that when I make a purchase order, a purchase orderline is automatically generated based on the purchase order_id. However, I'm getting a ORA-04071 error running the code below:

create or replace trigger "INKOOPORDER_T1"/
AFTER insert or update or delete on INKOOPORDER
for each row begin

INSERT INTO INKOOPORDERREGEL
    (I_nummer)
SELECT
    I_nummer
    FROM inkooporderregel
go
end/

Can somebody help me please?

jarlh
  • 42,561
  • 8
  • 45
  • 63
  • 2
    You are missing `;` at the end of the insert. And there is no `GO` in SQL. And the `/` after the first line is incorrect as well. See also here: http://stackoverflow.com/a/10207695/330315 –  May 22 '15 at 10:50

1 Answers1

1

ur query has some syntax errors

try below code

I removed / from first line and after End, put ; at the end of insert statement and deleted go.Also after end a ;

create or replace trigger "INKOOPORDER_T1"
AFTER insert or update or delete on INKOOPORDER
for each row 
begin

INSERT INTO INKOOPORDERREGEL
    (I_nummer)
SELECT
    I_nummer
    FROM inkooporderregel;

end;
Sachu
  • 7,555
  • 7
  • 55
  • 94
  • Thanks for your fast reply, the error is gone indeed. However A new purchase order is not shown in purchase order line. Do I need to add somthing to the code? – Boudewijn Visser May 22 '15 at 11:10
  • @BoudewijnVisser u r inserting I_Number to INKOOPORDERREGEL by selecting I_Number from same table..i can't understand what u r achieving here – Sachu May 22 '15 at 11:12
  • @BoudewijnVisser r u trying to insert the value from INKOOPORDER to INKOOPORDERREGEL – Sachu May 22 '15 at 11:15