简体   繁体   中英

table or view doesn't exist error

I'm using Oracle XE, in which i was making my own custom trigger. For that, I've made two tables INSERTED and ORDER_INFO in the SYSTEM schema, both have the same column name ORDER_ID, ORDER_DATE. In my scenario, client will be placing his/her order then, order information will be stored into INSERTED table, then by using this trigger, it'll insert into another table ORDER_INFO after satisfying the condition.

this is what i got till now,

CREATE TRIGGER tri_check
   AFTER INSERT ON inserted FOR EACH ROW
DECLARE
BEGIN
   IF :new.order_date < (SYSDATE + 2)
   THEN
       RAISE_APPLICATION_ERROR(-20000, 'You cannot take an order to be delivered less than 2 days from now');
   ELSE
      INSERT INTO orders_info (order_id, order_date)
      VALUES (:new.order_id, :new.order_date);
   END IF;
END;

While executing the above query, i'm getting this error

ERROR at line 7: PL/SQL: ORA-00942: table or view does not exist
5.    IF :new.order_date < (SYSDATE + 2)
6.    THEN
7.        RAISE_APPLICATION_ERROR(-20000, 'You cannot take an order to be delivered less than 2 days from now');
8.    ELSE
9.       INSERT INTO orders_info (order_id, order_date)

Need Help !!

It's because you do

INSERT INTO orders_info

instead of

INSERT INTO ORDER_INFO

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM