Oracle stored procedures and Oracle Storage

Source: Internet
Author: User

An Oracle stored procedure consists of three parts: a procedure declaration, a procedure part, and a stored procedure exception.

Oracle stored procedures can have parameter-free stored procedures and parameter-stored procedures.

Procedure syntax of a non-parametric program

Create or replace procedure Noparpro

as;

Begin

;

Exception//Stored procedure exception

;

End

Examples of stored procedures with parameters

Create or Replace procedure Queryempname (Sfindno Emp.empno%type) as

Sname Emp.ename%type;

Sjob Emp.job%type;

Begin

....

exception

....

End

Three, with the parameter stored procedure contains the assignment method

Create or Replace procedure Runbyparmeters (isal in Emp.sal%type,

Sname out varchar,sjob in out varchar)

As icount number;

Begin

Select COUNT (*) into the icount from EMP where sal>isal and job=sjob;

If Icount=1 Then

....

Else

....

End If;

exception

When Too_many_rows Then

Dbms_output. Put_Line (' return value more than 1 rows ');

When others then

Dbms_output. Put_Line (' Mistakes in the runbyparmeters process! ');

End

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/database/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.