爲什麼這給我錯誤?警告:使用編譯錯誤創建的過程?
CREATE OR REPLACE trigger customerLineCount
BEFORE insert on cust_line
for each row
when(new.cust_id > 0)
DECLARE
lineCount number;
BEGIN
select count (*) into lineCount
from (cust_line inner join customer
on cust_line.cust_id = customer.cust_id)
where (customer.cust_id = :new.cust_id)
if :new.gender = "m" and lineCount = 3 THEN
dbms_output.put_line ('Error! User already has 3 lines');
elseif :new.gender = "f" and lineCount = 1 THEN
dbms_output.put_line ('Error! User already has 1 line');
end if;
END customerLineCount;
/
請運行`show errors`來查看編譯錯誤消息是什麼(或者從user_errors等中選擇它) – derobert 2011-12-14 18:50:18