Oracle Tutorial

What is Oracle
SQL Keywords

Oracle Wildcards

Oracle Wildcards

Oracle Aliases

Oracle Aliases

MySQL Tutorial

MySQL Tutorial

PL/SQL Tutorial

PL/SQL Tutorial

Oracle Interview Questions

Oracle Interview Questions and Answers


Oracle Procedure

In Oracle, FUNCTION is simply a group of PL/SQL statements. The Oracle procedure are similar to any other language routine. It accept three types of parameters IN, OUT and IN OUT. you can create your own procedures in Oracle.

A function is a subprogram that is used to return a single value. You must declare and define a function before invoking it. It can be declared and defined at a same time or can be declared first and defined later in the same block. Just as you can in other languages, you can create your own functions in Oracle.

Oracle Create Procedure Syntax

To create a new Procedure, use the following syntax:

Syntax

Parameters:

In Oracle Procedure, there are three types of parameters that can be declared:

IN: This is a default parameter. This parameter can be referenced, but value can not be overwritten by the procedure or function.

OUT: This must be specified. This parameter can not be referenced, but the value of the parameter can be overwritten by the procedure or function.

IN OUT: This must be specified. This parameter can be referenced and the value of the parameter can be overwritten by the procedure or function.

Oracle Create Procedure Examples

The following Oracle statement to create new Procedure called "userInsert" which accept one parameter "name_in":

Example

Note:

In the above example, we have created a "userInsert" procedure, accept one parameter called "name_in". It has one parameter called name_in. The procedure will lookup the course_number based on course name. It then inserts a new record into the "tblUser" table.

Oracle Drop Procedure Syntax

To drop a Procedure, use Oracle DROP Procedure Statement, use the following syntax:

Syntax

Parameters:

procedure_name: The name of the Procedure that you wish to delete.

Oracle Drop Procedure Examples

In Oracle, you can drop Procedure with the Oracle DROP Procedure Statement:

Example

Note:

In the above example, it would drop/delete the Oracle Procedure called userInsert.