Home arrow Oracle arrow Page 7 - Oracle Stored Procedures

Debug 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

Letís introduce a compilation error into your procedure declaration.

Open your skeleton.sql file in Notepad. Replace the DBMS_OUTPUT.PUT_LINE procedure call with the NULLL statement (notice the three "l"s!), an invalid PL/SQL statement. Your program should look like this:

CREATE OR REPLACE PROCEDURE skeleton
IS
BEGIN
  NULLL;
END;
Save your file as skeleton.sql.

From SQL*Plus, open your skeleton.sql file.

SQL*Plus loads the contents of your skeleton.sql file into the SQL*Plus buffer or memory area and presents the SQL*Plus command prompt:

SQL>
  1  CREATE OR REPLACE PROCEDURE skeleton
  2  IS
  3  BEGIN
  4    NULLL;
  5* END;
SQL>

Execute the contents of the SQL*Plus buffer. Type a front slash and press <enter> like this:

SQL> /

Your procedure is compiled and saved on the database. However, SQL*Plus warns us of compilation errors:

Warning: Procedure created with compilation errors.

Letís see the compilation errors. First, we need to run two SET commands to ensure the SQL*Plus buffer does not overflow.

At the SQL*Plus command prompt, type:

SQL> SET ARRAYSIZE 1
SQL> SET MAXDATA 60000
SQL>

Again, SQL*Plus remains secretive of the result. Let's see the errors. At the SQL*Plus command prompt, type:

SQL> SHOW ERRORS PROCEDURE skeleton

You should see the compilation error:

LINE/COL
----------------------------------------------
ERROR
----------------------------------------------
4/3
PLS-00201: identifier 'NULLL' must be declared

4/3
PL/SQL: Statement ignored

Oracle doesn't recognize the NULLL statement with the three "l"s. But Oracle won't hold it against you.

Change your procedure declaration in Notepad by inserting the proper NULL statement, and follow the steps to create your procedure again on the Oracle database.

What if you want to completely remove a procedure from your database? That's what we'll cover next. 



 
 
>>> 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: