如何在更新/插入之前创建一个例外,我必须将一个表的属性值与另一个表的属性值进行比较?

时间:2018-02-22 14:57:07

标签: oracle exception plsql sql-update

架构是

CUSTOMER(Cus_code,Cus_fname,Cus_lname,Cus_balance)

INVOICE(Inv_no,Cus_code,Inv_date,Inv_amount)

LINE(Inv_no,Line_no,P_code,Line_units,Line_price)

PRODUCT(P_code,P_desc,P_qoh,P_min,P_price,V_code)

供应商(V_code,V_name,V_Contact)

create or replace trigger inexcb
before update 
of invoice.Inv_amount,customer.cus_balance
on invoice,customer  
for each row
when (invoice.Inv_amount>customer.cus_balance)
where invoice.cus_balance=customer.cus_balance
declare
excep1 exception;
begin
raise excep1;
dbms_output.put_line='Invoice amount becoming more than Customer balance is 
not allowed.';
end;

1 个答案:

答案 0 :(得分:0)

Field List

嗯,我刚刚提交了我的作业而没有提出一个真正的异常(由于时间的限制),但猜测就是这样。