Preamble
Oracle Procedure is a subprogram that performs a specific action.
Learn how to create and delete procedures in Oracle / PLSQL with syntax and examples.
CREATE PROCEDURE
As with other programming languages, you can create your own procedures in Oracle.
Syntax
CREATE [OR REPLACE] PROCEDURE name_procedures
[ (parameter [, parameter, ...]) ] IS
[local ads]
BEGIN
executable offers
[EXCEPTION
exception handlers]
END [procedure_name];
When creating a procedure or function, you can define three types of parameters that can be declared:
- IN – A parameter can refer to a procedure or function. The value of the parameter cannot be changed by the procedure or function.
- OUT – The parameter cannot refer to a procedure or function, but the parameter value can be changed by the procedure or function.
- IN OUT – The parameter can reference the procedure or function and the parameter values can be changed by the procedure or function.
Example
Let’s look at an example of how to create a procedure in Oracle.
CREATE OR REPLACE Procedure UpdateCourse
( name_in IN varchar2 )
IS
cnumber number;
cursor c1 is
SELECT course_number
FROM courses_tbl
WHERE course_name = name_in;
BEGIN
open c1;
fetch c1 into cnumber;
if c1%notfound then
cnumber := 9999;
end if;
INSERT INTO student_courses
( course_name,
course_number )
VALUES
( name_in,
cnumber );
commit;
close c1;
EXCEPTION
WHEN OTHERS THEN
raise_application_error(-20001,'An error was encountered - '||SQLCODE|' -ERROR- '||SQLERRM);
END;
This procedure is called the UpdateCourse. It has one parameter, called name_in. The procedure will search for course_number by the value of course_name. If the search is unsuccessful, then course_number is 99999 by default. Then a new record is inserted into the student_courses table.
|
DROP PROCEDURE
Once you have created your Oracle procedure, you may need to remove it from the database.
Syntax for deleting the procedure in Oracle
DROP PROCEDURE procedure_name;
- procedure_name – is the name of the procedure you want to delete.
Example: .
Let’s take a look at an example of how to remove a procedure in Oracle.
DROP PROCEDURE UpdateCourse;
In this example, we remove a procedure called UpdateCourse.
About Enteros
Enteros offers a patented database performance management SaaS platform. It proactively identifies root causes of complex business-impacting database scalability and performance issues across a growing number of clouds, RDBMS, NoSQL, and machine learning database platforms.
The views expressed on this blog are those of the author and do not necessarily reflect the opinions of Enteros Inc. This blog may contain links to the content of third-party sites. By providing such links, Enteros Inc. does not adopt, guarantee, approve, or endorse the information, views, or products available on such sites.
Are you interested in writing for Enteros’ Blog? Please send us a pitch!
RELATED POSTS
Enteros for Insurance: Redefining AI Performance, Data Lake Management, and Cloud FinOps Excellence
- 7 October 2025
- Database Performance Management
Introduction The insurance industry stands at the crossroads of transformation — where data-driven insights, artificial intelligence (AI), and cloud technologies are reshaping business operations. Today’s insurers operate in a digital-first world, collecting and analyzing enormous volumes of data from multiple channels — customer interactions, policy applications, claims, IoT devices, and third-party providers. This explosion of … Continue reading “Enteros for Insurance: Redefining AI Performance, Data Lake Management, and Cloud FinOps Excellence”
Revolutionizing Healthcare IT: How Enteros AIOps and Observability Platforms Are Transforming Database Performance Management
Introduction In today’s data-driven healthcare landscape, precision, speed, and reliability are paramount. From real-time patient monitoring and electronic health records (EHRs) to AI-assisted diagnostics and predictive analytics, healthcare organizations rely on massive databases and complex IT infrastructures to deliver life-saving insights and services. However, as data volumes surge and systems become more distributed, managing database … Continue reading “Revolutionizing Healthcare IT: How Enteros AIOps and Observability Platforms Are Transforming Database Performance Management”
From Data to Delivery: How Enteros Transforms D2C Brands Through Database Performance and Cloud FinOps
- 6 October 2025
- Database Performance Management
Introduction In the fast-evolving world of Direct-to-Consumer (D2C) brands, agility and performance are everything. D2C businesses thrive on personalization, speed, and customer trust — all of which depend on how efficiently data flows through their systems. Behind every product recommendation, every smooth checkout, and every on-time delivery is a complex network of databases, cloud infrastructure, … Continue reading “From Data to Delivery: How Enteros Transforms D2C Brands Through Database Performance and Cloud FinOps”
How Enteros AI Performance and Data Lake Optimization Are Powering Innovation in the Fashion Industry
Introduction The fashion industry, once ruled by instinct and creativity alone, is now undergoing a seismic transformation driven by data and artificial intelligence (AI). From forecasting trends to managing supply chains and customer experiences, data-driven insights are redefining how fashion brands operate. Central to this digital shift is the use of AI-driven performance management and … Continue reading “How Enteros AI Performance and Data Lake Optimization Are Powering Innovation in the Fashion Industry”