sql - Raise Application Error in Trigger and still update table -


I am facing some problem, when the customer does not pay in 60 days, the trigger will update the customer table and Still get error-20003.

What do I know that the update function will be canceled when the exception exception is made?

Is there no way to do this?

Description of each line; cust_ID BILL.custID% Create or replace traggers before reading for TYPE; Posted_bind BILL.sentDate% TYPE; Pay_date billingpayment date% type; Bad_StatusCustomer.badStatus% TYPE; First_name Clients First name% TYPE; Last_name CUSTOMER.lastName% TYPE; NRIC- Any customer RIC% type; PRAT_ID CUSTOMER.pRateID% TYPE; No_new_reading exceptions; Select cursor cust_cursor b.custID, b.sentDate, b.paymentDate, c.badStatus, c.firstName, c.lastName, c.NRIC, c.pRateID to bill b, customer c, read WHERE (sysdate - SentDate) & gt; 20 and the period of payment b.readingID for the update of zero and B.code = C custid and r.readingID = c.badStatus; BEGIN open cust_cursor; Loop Fetch cust_cursor in cust_ID, sent_date, payment_date, bad_Status, first_name, last_name, nrc_new, pRate_ID; If CFCCRC% turns out, then exit; end if; If CRCCRAR% ROWCOUNT = 0 THEN DBMS_OUTPUT.PUT_LINE ('No customer was found'); ELSE update customer set pRATID = 801, badStatus = 'non-payment' where the current of cust_cursor; RAISE no_new_reading; end if; End loop; Close cust_cursor; COMMIT; Exception when NO_new_reading then RAISE_APPLICATION_ERROR (-20003, 'Customer' || first_name || '' || last_name || '' water supply has been deducted); When others DBMS_UUPUTU PUT_LINE (SKEELRM); End; /

This can be resolved in the following ways Create a process for updating the customer table

  Process update to make / replace customer as a practical autonomy; Set up customer c.badStatus = 'Non Payment', c.pRateID = 801 where c.custID = (differently c custid from bill b, reading r WHERE (sysdate - sentDate)> 20 and the payment date is zero And B.custID = c.custID and r.readingID = b.readingID); Committed; End; /  

Use the trigger to call the process itself

Description of each line before the reader for the cust_ID BILL.custID% TYPE Create or change cut-assist; Posted_bind BILL.sentDate% TYPE; Pay_date billingpayment date% type; Bad_StatusCustomer.badStatus% TYPE; First_name Clients First name% TYPE; Last_name CUSTOMER.lastName% TYPE; NRIC- Any customer RIC% type; Reject_new_ring_exce exception; Select cursor cust_cursor b.custID, b.sentDate, b.paymentDate, c.badStatus, c.firstName, c.lastName, c.NRIC to bill b, customer c, reading r WHERE (sysdate - sentDate) & gt; 20 and the duration of the payment is zero and B.Costid = C-custid and r.readingID = b.readingID; BEGIN open cust_cursor; Loop fetch cust_cursor in cust_ID, sent_date, payment_date, bad_Status, first_name, last_name, nrc_no; If CFCCRC% turns out, then exit; end if; If CRCCRAR% ROWCOUNT = 0 THEN DBMS_OUTPUT.PUT_LINE ('No customer was found'); ELSE update_customer; RAISE reject_en_widing_exp; end if; End loop; Close cust_cursor; COMMIT; Exception was rejected when_NEW_reading_xCP then RISE_APPLICARAR (-20003, 'customer' || first_name || '' = last_name || '' water supply has been cut); When others DBMS_UUPUTU PUT_LINE (SKEELRM); End; /

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -