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 Transforms Healthcare Cost Management with AI Financial Intelligence and Database Performance Optimization
- 4 December 2025
- Database Performance Management
Introduction The healthcare sector is facing unprecedented financial and operational pressure. As medical organizations modernize their IT environments—embracing AI-driven diagnostics, telemedicine platforms, electronic health record (EHR) systems, imaging repositories, and cloud-native applications—the cost of operating these digital workloads continues to surge. At the same time, inefficiencies within databases, data pipelines, clinical software platforms, and analytics … Continue reading “How Enteros Transforms Healthcare Cost Management with AI Financial Intelligence and Database Performance Optimization”
Optimizing Retail Digital Operations: Enteros AI Platform for Accurate Cost Estimation and Superior Performance Management
Introduction The retail sector is undergoing one of the fastest digital transformations in history. From omnichannel commerce and predictive analytics to inventory automation and personalized customer experiences, today’s retail enterprises depend on complex, high-volume digital systems. These systems—spanning eCommerce platforms, databases, cloud services, POS solutions, and logistics software—process massive real-time workloads that directly influence customer … Continue reading “Optimizing Retail Digital Operations: Enteros AI Platform for Accurate Cost Estimation and Superior Performance Management”
How Technology Teams Improve Performance Management with Enteros’ AIOps and AI-First Operations Framework
- 3 December 2025
- Database Performance Management
Introduction The technology sector is undergoing a rapid transformation as cloud-native architectures, SaaS ecosystems, and real-time data systems redefine how organizations operate. Yet with this digital acceleration comes an overwhelming surge in complexity — distributed microservices, multi-cloud deployments, AI-augmented workflows, and massive data pipelines that demand precision, speed, and resilience. To navigate this complexity, enterprises … Continue reading “How Technology Teams Improve Performance Management with Enteros’ AIOps and AI-First Operations Framework”
The Future of Healthcare Databases: Enteros’ GenAI and AI Performance Management at Work
Introduction The healthcare sector is undergoing a digital revolution unlike anything seen before. From AI-assisted diagnostics and precision medicine to telehealth platforms and clinical research systems, today’s healthcare organizations rely heavily on massive data ecosystems. Databases power everything — electronic health records (EHRs), patient management systems, revenue cycle applications, insurance claim platforms, imaging archives, and … Continue reading “The Future of Healthcare Databases: Enteros’ GenAI and AI Performance Management at Work”