我正在尝试编写一个触发器来验证客户/地址在插入之前是否存在,但我遇到了一些错误。能就此提出建议吗?
下表是:
客户 (CustID,CustName,DOB)
CREATE OR REPLACE TRIGGER CREATEACCOUNT
BEFORE INSERT ON ACCOUNT
FOR EACH ROW
DECLARE
newCustID varchar(10);
newPostCode int;
newStreet char;
newAccType varchar(15);
newAccStatus char(9);
newAccBalance int;
varRowCount int;
BEGIN
newCustID := :new.CustID;
SELECT COUNT(*)
INTO varRowCount
FROM Customer
WHERE CustID = newCustID;
IF (varRowCount > 0) THEN
RETURN;
END IF;
IF (varRowCount = 0) THEN
BEGIN
INSERT INTO CUSTOMER VALUES (newCustID,:new.CustName,:new.DOB);
END;
END IF;
END;
以下是错误消息:
错误(27,46):PLS-00049:错误绑定变量“NEW.CUSTNAME”
错误(27,60):PLS-00049:错误绑定变量“NEW.DOB”