I'm creating a trigger within my database, I came across two error that I am not able to fix, I'm pretty sure that those two are relating to my use of DBMS_OUTPUT.PUT_LINE, the rest of the statement does not cause any errors, although it had before.
Errors:
Error(5,3): PL/SQL: SQL Statement ignored
Error(5,15): PL/SQL: ORA-00903: invalid table name
Code:
CREATE TRIGGER INVOICES
BEFORE INSERT OR UPDATE ON BRUINVOICE
FOR EACH ROW
BEGIN
IF :new.BRU_DATE < :new.BRU_PAID_DATE THEN
DBMS_OUTPUT.PUT_LINE('You cannot do that');
ELSE
INSERT INTO table BRUINVOICE
values
from inserted;
END IF;
END;
INSERTdoesn't make sense. There is notablekeyword in anINSERTstatement, it seems unlikely that you've created a table namedinsertedto select from and if you are intending to select from another table, you'd need anINSERT ... SELECT. But since you're apparently inserting into the same table that your trigger is defined on, I'm hard-pressed to imagine what you are trying to accomplish. Maybe you want to raise an error rather than writing todbms_outputand remove theELSEclause entirely?