function, procedure, packages, package bodies comparisons in Oracle

Source: Internet
Author: User

1 The difference between function and procedure

1). You can understand that a function is a 2 of a stored procedure. A function can have no parameters, but a return value must be required, and the stored procedure can have no parameters and does not need to return a value of 3. The return value of the function returned does not return a parameter pattern, and the stored procedure returns the value through the out parameter. Stored Procedure 4 is recommended if you need to return more than one parameter. Only functions can be called in SQL data manipulation statements, not stored procedures, 5). function must have a return value, and only one return value; 6). Procedur not called return value, called out, can bring out multiple values; 7). Packages, package, bodies are present at the same time, packages may include Function,procedure 8). Procedure and function can exist separately, or can be placed in bodies.

2 packages, compared with packagebodies

Definition: Packae is a container that binds processes, functions, and data structures together and consists of two parts: external visual package specifications, including function headers, process headers, and external visual data structures, and the package body, the package body, which contains all the       The Declaration, execution, exception handling parts of the bundled procedures and functions.       In short, there is only the definition of each method in packages, and the bodies involves the concrete implementation.       So packages and packagebodies are one and must exist at the same time. If you want to call it externally, declare it in the package, and just write it inside the body.       The package may include function,procedure.       You need to create a package (that is, the definition of a bundle) before you create the body. Add the procedure in the package or modify the number of input parameters of the process in the package.

3 The role of the package

Can simplify application design, improve application performance, implement information hiding, subroutine overloading

function, procedure, packages, package bodies comparisons in Oracle

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.