triggers are not working as expected and giving compilation error
触发器没有按预期工作并导致编译错误
Error(7,11): PLS-00201: identifier 'NA.TITLE_ID' must be declared
错误(7、11):请- 00201:标识符的NA。TITLE_ID必须声明
here is my trigger
这是我的触发器
CREATE OR REPLACE TRIGGER is_title_available
BEFORE INSERT ON rental
REFERENCING OLD AS o NEW AS na
FOR EACH ROW
WHEN (na.TITLE_ID > 0)
DECLARE
isavailable boolean;
temp number;
title_not_available EXCEPTION;
BEGIN
temp :=na.TITLE_ID;
if(TITLE_AVAILABLE(temp)) then
dbms_output.put_line('title available rent entry inserted');
else
raise title_not_available;
end if;
END;
and here is my table schema
这是我的表格模式。
CREATE TAble rental(
BOOK_DATE date DEFAULT sysdate primary key,
MEMBER_ID int,
COPY_ID int ,
TITLE_ID int,
ACT_RET_DATE date,
EXPIRY_RET_DATE date DEFAULT sysdate+2
);
ALTER TABLE rental
ADD CONSTRAINT fk_member_rental
FOREIGN KEY (MEMBER_ID)
REFERENCES MEMBER(MEMBER_ID);
1 个解决方案
#1
2
Please try below way
:na.Title_ID
请尝试以下方式:na.Title_ID
You need to use ':' (colon) to access value of new or old reference.
您需要使用':'(冒号)来访问新的或旧引用的值。
#1
2
Please try below way
:na.Title_ID
请尝试以下方式:na.Title_ID
You need to use ':' (colon) to access value of new or old reference.
您需要使用':'(冒号)来访问新的或旧引用的值。