1

This is my SQL code:

CREATE OR REPLACE TRIGGER Promjenaplacanja
BEFORE UPDATE
ON Placanje
FOR EACH ROW
DECLARE
v_PlacanjeID NUMBER(10,0);
v_Starinacin NVARCHAR2(50);
v_Novinacin NVARCHAR2(50);

BEGIN

BEGIN
  SELECT :OLD.PlacanjeID ,
         :OLD.Nacin_Placanja 

    INTO v_PlacanjeID,
         v_Starinacin
    FROM DUAL ;
  SELECT :NEW.Nacin_Placanja 

    INTO v_Novinacin
    FROM DUAL ;
  INSERT INTO Auditplacanja
    ( PlacanjeID, Starinacin, Novinacin, Datum )
    VALUES ( v_PlacanjeID, v_Starinacin, v_Novinacin, SYSDATE ); 
END;
END;

But I got these two errors:

Error(16,7): PL/SQL: SQL Statement ignored Error(16,19): PL/SQL: ORA-00942: table or view does not exist

I don't get it, can anyone help? :\ Thanks.

2
  • 6
    Post the code in the question. Please Commented Feb 25, 2013 at 13:14
  • Do not select from dual values, insert OLD and NEW values directly into the table... Commented Feb 25, 2013 at 13:25

1 Answer 1

3

Table or view does not exist. Your trigger points to a table in 2 places:

1) Creation of the trigger: placanje

2) The insert statement: auditplacanja (perhaps auditplacanje?).

Do both of these tables exist (in the schema you run the code)?

Sign up to request clarification or add additional context in comments.

2 Comments

Auditplacanje does not exist. So I have to create table first? (It's auditplacanje, my bad)
First create the table before you can reference it in other code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.