The biggest difference between Oracle FUNCTION and PROCEDURE

Source: Internet
Author: User

The biggest difference between Oracle functions and PROCEDURE is that Oracle functions allow DML statements, but cannot be used for queries.
Our commonly used functions include select max (a) from table. This call method cannot execute functions with DML. However, if you do not need to use SQL, You can have DML, such as dbms_output.put_line (func (...). If the function uses autonomous transactions, you can use DML. What is "autonomous transactions ":
An autonomous transaction is an independent transaction that can be called in other transactions. An autonomous transaction can cause the transaction to execute SQL operations, commit or roll back other operations, return to the context of the transaction, and continue to call the transaction. After an autonomous transaction is called, the transaction is completely independent from the master transaction that calls it. You will not see any changes that have not been committed to the primary transaction, and will not share the locks or resources of the primary transaction. Changes in autonomous transactions can be seen by other transactions after they are committed. An autonomous transaction can call other autonomous transactions. There is no limit on the number of nested layers.

Related Article

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.