Home arrow Oracle arrow Page 3 - Oracle Stored Procedures

Write a procedure - Oracle

So what's this business with Oracle allowing programmers to put programs in databases? That's right. They're called Oracle stored procedures, and they're quite useful. Mooh the Cow walks you through writing, creating, debugging, and deleting a procedure.

TABLE OF CONTENTS:
  1. Oracle Stored Procedures
  2. Before you start
  3. Write a procedure
  4. Create a procedure
  5. Run a procedure
  6. Change a procedure
  7. Debug a procedure
  8. Drop a procedure
  9. What you have learned
  10. Further reading
By: Mooh The Cow
Rating: starstarstarstarstar / 879
January 03, 2005

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Procedures are written in Oracle's PL/SQL programming language.

Letís write a harmless procedure that does nothing, so we can compile and run it with no fear of damage to your database.

In Notepad, type:

CREATE OR REPLACE PROCEDURE skeleton
IS
BEGIN
  NULL;
END;

Save your file as skeleton.sql.

Letís go through the procedure line by line. The lines are numbered for your convenience:

1 CREATE OR REPLACE PROCEDURE skeleton
2 IS
3 BEGIN
4   NULL;
5 END;

Line 1:

CREATE OR REPLACE PROCEDURE is an SQL statement that instructs Oracle to create a procedure called skeleton, and to overwrite it if it exists.

Line 2:

The IS keyword signals that a PL/SQL body will follow.

Line 3:

The BEGIN keyword signals the start of a PL/SQL body.

Line 4:

The NULL PL/SQL statement indicates that no action should be performed. We cannot just leave it out, because at least one statement is required in a PL/SQL body.

Line 5:

The END keyword signals the end of the PL/SQL block.

Now let's move on to creating a procedure.
 



 
 
>>> More Oracle Articles          >>> More By Mooh the Cow
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

ORACLE ARTICLES

- Oracle Java Security Woes Continue
- Oracle's New IaaS Cloud Option: There's a Ca...
- Oracle Acquires Eloqua to Boost Cloud Presen...
- Choosing Innovation: Oracle Survey Insights
- Oracle Fixes Privilege Escalation Bug
- Oracle`s Communications Service Availability...
- Oracle Releases Exalytics, Taleo Plans
- Oracle Releases Communications Network Integ...
- Oracle Releases Communications Data Model 11...
- Oracle Releases PeopleSoft PeopleTools 8.52
- Oracle Integrates Cloudera Apache Distro, My...
- Oracle Releases MySQL 5.5.18
- Oracle Announces NoSQL Database Availability
- Sorting Database Columns With the SELECT Sta...
- Retrieving Table Data with the LIKE Operator

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: