The AS keyword is used instead of the IS keyword for creating a standalone procedure. Procedure-body contains the executable part. IN represents the value that will be passed from outside and OUT represents the parameter that will be used to return a value outside of the procedure. The optional parameter list contains name, mode and types of the parameters. option allows the modification of an existing procedure. Procedure-name specifies the name of the procedure. The simplified syntax for the CREATE OR REPLACE PROCEDURE statement is as follows −ĬREATE PROCEDURE procedure_name It contains the code that handles run-time errors.Ī procedure is created with the CREATE OR REPLACE PROCEDURE statement. This is a mandatory part and contains statements that perform the designated action. These items are local to the subprogram and cease to exist when the subprogram completes execution. It contains declarations of types, cursors, constants, variables, exceptions, and nested subprograms. However, the declarative part for a subprogram does not start with the DECLARE keyword. Like anonymous PL/SQL blocks, the named blocks will also have the following three parts − S.No Parts of a PL/SQL SubprogramĮach PL/SQL subprogram has a name, and may also have a parameter list. We will discuss PL/SQL function in the next chapter. This chapter is going to cover important aspects of a PL/SQL procedure. Procedures − These subprograms do not return a value directly mainly used to perform an action. PL/SQL provides two kinds of subprograms −įunctions − These subprograms return a single value mainly used to compute and return a value. PL/SQL subprograms are named PL/SQL blocks that can be invoked with a set of parameters. We will discuss packages in the chapter 'PL/SQL - Packages'. It is stored in the database and can be deleted only when the package is deleted with the DROP PACKAGE statement. It is stored in the database and can be deleted with the DROP PROCEDURE or DROP FUNCTION statement.Ī subprogram created inside a package is a packaged subprogram. It is created with the CREATE PROCEDURE or the CREATE FUNCTION statement. A subprogram can be invoked by another subprogram or program which is called the calling program.Īt the schema level, subprogram is a standalone subprogram. This is basically called the 'Modular design'. These subprograms are combined to form larger programs. A subprogram is a program unit/module that performs a particular task. In this chapter, we will discuss Procedures in PL/SQL.
0 Comments
Leave a Reply. |