Oracle Stored Procedure Syntax

Source: Internet
Author: User

The basic syntax for ORACLE stored procedures is as follows:

Create or Replace procedure stored procedure name (parameter) is or as

Declaring parameters

Begin

Code

End stored procedure name.

Where or replace represents the creation if no such stored procedure is created and, if any, updates the stored procedure.

Here is a simple example of a stored procedure:

Create or Replace procedurevid_unregstatenocharging (Ptelnoinch varchar2, PClassinch  Number, PVidinchOutvarchar2, Pagentinch varchar2, PRoleinch varchar2, PRe out Number, Pdesc outvarchar2) isTtmpnum Number:=0; Tvidonunregrenotes Number:=0;begin    Select Count(*) intoTtmpnum fromT_onlinewhereTelno=Ptelno; if(Ttmpnum< 1) Then         Select Count(*) intoTvidonunregrenotes fromT_unreg_logwhereTelno=Ptelno; if(tvidonunregrenotes>1) ThenpRe:=Ten; Pdesc:='the user is logged out and cannot be billed.'; return; End if; End if; Commit; PRe:=0; Pdesc:='Normal'; return;Endvid_unregstatenocharging;

Stored procedures can have some logical judgments, you can also store procedure calls stored procedures, the above in represents the input parameters, out represents the output parameters.

Oracle stored procedure syntax

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.