PB development realm multiple DW for update

Source: Internet
Author: User

Update multiple DW data

// Cainiao Code
Dw_1.up Dat E ()
Dw_2.update ()
Initial code
If dw_1.update () = 1 and dw_2.update () = 1 then
Commit;
Else
Rollback;
End if
Intermediate code
If dw_1.update () = 1 then
If dw_2.update () = 1 then
Commit;
Else
MessageBox ("prompt", "too much! ")
Rollback;
End if
Else
MessageBox ("prompt", "too much! ")
Rollback;
End if
Advanced Code
If dw_1.update () = 1 then
If dw_2.update () = 1 then
Commit;
Else
Rollback;
MessageBox ("prompt", "Drink less! ")
End if
Else
Rollback;
MessageBox ("prompt", "Drink less! ")
End if
Expert code
If dw_1.update (true, false) = 1 then
If dw_2.update (true, false) = 1 then
Dw_1.resetupdate ()
Dw_2.resetupdate ()
Commit;
Else
Rollback;
MessageBox ("prompt", "not high! ")
End if
Else
Rollback;
MessageBox ("prompt", "not high! ")
End if

 

 

When multiple DW data is updated, sometimes it cannot be all successfully updated. When a transaction is processed, multiple DW data is up.DatE, and then commit. By accident, we will find that the previous DW update is successful, but when the following table fails, it seems that the commit is executed and will not roll back.

The correct syntax is as follows:
If dw_1.update (true, false) = 1 and dw_2.update (true, false) = 1... then
Commit;
Dw_1.resetupdate ();
Dw_2.resetupdate ();

else
rollback;
end if

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.