How to Use the midstream mark in Oracle

Source: Internet
Author: User

The most commonly used cursor operation is to Perform Batch modification or batch deletion operations in the stored procedure. For example, after deleting a master table record, you can execute a stored procedure to delete the detailed records corresponding to the record. Or modify the data of a table and then write the data of another table. This is often used in ERP software development. For example, the actual lifting weight on the contract should be reversed after the warehouse picking and submitting a single instance, which should also be supported by a good database design.

The following describes how to use a cursor in an oracle stored procedure:

  1. Procedure proc_fee_bymaindel (p_mainid in varchar2)
  2. Is
  3. -- ID of the pre-deletion ticket
  4. N_feeid varchar2 (32 );
  5. Cursor cur
  6. Is
  7. Select feeid
  8. From efi_feeadjustsubline
  9. Where isdel = 0 and mainid = hextoraw (p_mainid );
  10. Begin
  11. For cur_result in cur
  12. Loop
  13. Begin
  14. N_feeid: = cur_result.feeid;
  15. Proc_fee_del (n_feeid );
  16. Exception
  17. When others
  18. Then-insert an error
  19. -- Assign values to the return value
  20. Raise_application_error (-20000,
  21. 'Fee deletion error! '
  22. | Sqlerrm
  23. );
  24. Goto proc_end;
  25. End;
  26. End loop;
  27. <Proc_end>
  28. NULL;
  29. End proc_fee_bymaindel;

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.