-1 oracle plsql syntax-error oracle11g
我创建了Trigger来检查广告表中的付款并且应该更新另一个表(customer_account)有人知道bug在哪里吗?
CREATE OR REPLACE TRIGGER Payment_check
after UPDATE ON Ads
FOR EACH ROW
BEGIN
IF NEW.Pay_done==('y'||'Y')THEN
UPDATE customer_account SET customer_account.Plcd_ads = NEW.Ad_id
WHERE customer_account.C_id = NEW.Customer;
ELSE
UPDATE customer_account SET customer_account.Pend_ads = NEW.Ad_id
WHERE customer_account.C_id = NEW.Customer;
END IF;
END;
//////bug
Error at line 7: PLS-00103: Encountered the symbol "." when expecting one of the following:
mod
continue current sql execute forall merge
pipe purge
The symbol "" was substituted for "." to continue.
5. IF NEW.Pay_done==('y'||'Y')THEN
6. UPDATE customer_account SET customer_account.Plcd_ads = NEW.Ad_id
7. WHERE customer_account.C_id = NEW.Customer;
8. ELSE
9. UPDATE customer_account SET customer_account.Pend_ads = NEW.Ad_id
Run Code Online (Sandbox Code Playgroud)
还请提供表创建语句,以便轻松重现错误.
这有两个可能的问题.如果这不能解决错误,请更改这些并更新问题.
1)新运营商需要以":"为前缀
2)检查pay_done标志的条件可能只是"上限(:NEW.Pay_done)='Y'"
CREATE OR REPLACE TRIGGER Payment_check
AFTER UPDATE
ON Ads
FOR EACH ROW
BEGIN
IF upper(:NEW.Pay_done) = 'Y' THEN
UPDATE customer_account SET customer_account.Plcd_ads = :NEW.Ad_id
WHERE customer_account.C_id = NEW.Customer;
ELSE
UPDATE customer_account SET customer_account.Pend_ads = :NEW.Ad_id
WHERE customer_account.C_id = :NEW.Customer;
END IF;
END;
Run Code Online (Sandbox Code Playgroud)