0
삽입 또는 업데이트 작업을 수행 할 때이 트리거에 문제가 있습니다. 트리거는 오류없이 만들어집니다. 목표는 invoice_total이 payment_total + credit_total의 합계보다 큰지 확인하는 것입니다. 어떤 도움이 많이 주시면 감사하겠습니다 :구현시 Oracle SQL 트리거 변경
Create or Replace Trigger invoices_before_update_payment
Before Insert or Update On invoices
For Each Row
Declare
InvTotal Number;
t_payment Number;
t_credit Number;
Begin
select invoice_total, payment_total, credit_total
Into
InvTotal, t_payment, t_credit
From invoices
Where invoice_id = :New.invoice_id;
DBMS_OUTPUT.PUT_LINE(InvTotal);
If (InvTotal) < (t_payment + t_credit)
Then
Raise_application_error(-20005, 'Invoice total is larger than the credit total and payment total');
End if;
End;
/