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 Guide to Enhancing Customer Experience Through Intelligent Database Performance Management
- 29 May 2026
- Database Performance Management
In today’s digital-first economy, customer experience has become one of the most important competitive differentiators for businesses across every industry. Customers expect applications and digital platforms to deliver fast response times, uninterrupted availability, seamless transactions, and personalized interactions at all times. Whether customers are using banking applications, SaaS platforms, e-commerce websites, healthcare portals, telecommunications systems, … Continue reading “Enteros Guide to Enhancing Customer Experience Through Intelligent Database Performance Management”
Boost Digital Customer Experience with Proactive Database Performance Optimization
In today’s digital economy, customer experience has become the foundation of business success. Customers expect every digital interaction — whether through mobile apps, SaaS platforms, e-commerce websites, financial systems, or customer portals — to be fast, seamless, reliable, and always available. A slow-loading application, delayed transaction, failed login, or service outage can instantly damage customer … Continue reading “Boost Digital Customer Experience with Proactive Database Performance Optimization”
How to Optimize Retail Software Performance with Enteros RevOps Automation and Database Analytics
Introduction The retail industry is evolving rapidly as organizations modernize operations, expand digital commerce platforms, and adopt cloud-native technologies to improve customer experiences, operational efficiency, and business scalability. Modern retail ecosystems now support: Ecommerce platforms Omnichannel retail operations Customer engagement applications Inventory management systems AI-driven recommendation engines Retail analytics platforms Cloud-native retail infrastructures Real-time transaction … Continue reading “How to Optimize Retail Software Performance with Enteros RevOps Automation and Database Analytics”
How to Improve Media Analytics Performance with Enteros Database Optimization
Introduction The media industry is evolving rapidly as organizations accelerate digital transformation initiatives to support streaming services, digital advertising platforms, real-time audience analytics, content delivery systems, and cloud-native media infrastructures. Modern media ecosystems now support: Video streaming platforms Digital advertising systems Audience analytics environments Content management systems Real-time recommendation engines Social media engagement platforms Cloud-native … Continue reading “How to Improve Media Analytics Performance with Enteros Database Optimization”