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
How Enteros Enables High-Performance Retail Platforms Using AI SQL and GenAI
- 18 January 2026
- Database Performance Management
Introduction Retail has become one of the most data-intensive and performance-sensitive industries in the digital economy. From omnichannel commerce and real-time inventory visibility to personalized recommendations, dynamic pricing, loyalty platforms, and fraud prevention, modern retail experiences depend on complex software ecosystems powered by high-volume databases. Customers now expect instant search results, seamless checkout, personalized experiences, … Continue reading “How Enteros Enables High-Performance Retail Platforms Using AI SQL and GenAI”
How Enteros Enables High-Performance, Cost-Efficient Real Estate Technology Platforms
Introduction The real estate industry has evolved into a technology-driven business. From digital property listings and virtual tours to CRM systems, valuation models, transaction platforms, tenant portals, and analytics dashboards, modern real estate enterprises rely on complex software ecosystems powered by data-intensive databases. At the heart of these platforms lies a fundamental challenge: how to … Continue reading “How Enteros Enables High-Performance, Cost-Efficient Real Estate Technology Platforms”
Accurate Healthcare Cloud Cost Estimation with Enteros: An AIOps-Driven FinOps Approach
- 15 January 2026
- Database Performance Management
Introduction Healthcare organizations are undergoing rapid digital transformation. Electronic health records (EHRs), telemedicine platforms, AI-driven diagnostics, patient engagement portals, population health analytics, and regulatory reporting systems now form the backbone of modern healthcare delivery. At the center of all these innovations lies a complex, data-intensive cloud infrastructure powered by mission-critical databases. While cloud adoption has … Continue reading “Accurate Healthcare Cloud Cost Estimation with Enteros: An AIOps-Driven FinOps Approach”
Why Traditional Banking Database Optimization Falls Short, and How Enteros Fixes It with GenAI
Introduction Modern banking has become a real-time, always-on digital business. From core banking systems and payment processing to mobile apps, fraud detection, risk analytics, and regulatory reporting—every critical banking function depends on database performance. Yet while banking technology stacks have evolved dramatically, database optimization practices have not. Most banks still rely on traditional database tuning … Continue reading “Why Traditional Banking Database Optimization Falls Short, and How Enteros Fixes It with GenAI”