Oracle stored procedures and custom functions

Source: Internet
Author: User

create [or replace] PRocedure procedure name (parameter list)

As

Plsql Sub-program body;

After the stored procedure is finished, the stored procedure is called;

There are two ways of doing this:

1.exec stored procedure name ();

2.pl/sql

Begin

Stored procedure name ();

End

/

How to debug and run PL/SQL statements;

Enter Debeg mode

A function is a named stored program, can take parameters, and returns a computed value; A program written with a PL/SQL statement;

Functions and procedures are similar in structure, but must have a return clause for returning function values;

create [or replace] function name (parameter list);

return function value type;

As

Plsql Sub-program body;

In and out parameters;

In general, the difference between a stored procedure and a stored function is that the storage function can have a return value;

And the stored procedure has no return value;

Both procedures and functions can specify one or more output parameters through out, and we can use out parameters to return multiple values in procedure and function implementations;

Both stored procedures and stored functions can have out parameters:

Both stored procedures and stored functions can have multiple out parameters;

The stored procedure can implement the return value through the out parameter;

When to use stored procedures/storage functions;

Principle:

If there is only one return value, use the stored function, otherwise, use the stored procedure;

How stored functions and stored procedures are called in the application;

Oracle stored procedures and custom functions

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.