Solved

Oracle Package body problem - major headache

Posted on 2006-11-07
2
655 Views
Last Modified: 2008-01-09
I'm trying to create a package that will run dbms_job to kick off a nightly procedure.  NB This is Oracle 7.

The package compiles fine, but the package body just will not compile.  The procedure is compiled fine.

Package:
CREATE OR REPLACE
 PACKAGE <mypkg>
as procedure  
<mypkg>;
end;  

Package body:
CREATE OR REPLACE
 PACKAGE BODY <mypkg>
as PROCEDURE <myproc> IS
  jobno NUMBER;
begin
 dbms_job.submit (jobno,
                  'begin <myproc>; end;',
                   'sysdate+3/1440',
                  'TRUNC(sysdate+1)+3/24');
END;
/

The error I get with this version is:
Line 10 col 0
PLS-00103: Encountered the symbol ";" when expecting one of the following:
begin end function package pragma procedure form

If I replace END; with END PROCEDURE;
the error message changes to
Line 8 col 5
PLS-00103: Encountered the symbol "PROCEDURE" when expecting one of the following:
; <an identifier> <a double-quoted delimited-identifier>
<a single-quoted SQL string> delete existst prior

If I replace END; with END <myproc>;
the error message changes to
Line 9 col 0
PLS-00103: Encountered the symbol ";" when expecting one of the following:
begin end function package pragma procedure form

and if I replace END; with END PROCEDURE <myproc>;
the error goes back to the same as with just PROCEDURE.

WHAT am I doing wrong here???

NB have also re-run catproc.sql in case the problem was corruption of dbms_job and everything compiled fine.
0
Comment
Question by:dramacqueen
2 Comments
 
LVL 7

Accepted Solution

by:
lappins earned 250 total points
ID: 17887931
You gave not supplied an END statement for the package bod, only the procedure. It can be helpful to name your end statements as well:

CREATE OR REPLACE
 PACKAGE BODY <mypkg>
as PROCEDURE <myproc> IS
  jobno NUMBER;
begin
 dbms_job.submit (jobno,
                  'begin <myproc>; end;',
                   'sysdate+3/1440',
                  'TRUNC(sysdate+1)+3/24');
END <myproc>;
END <mypkg>;
/
0
 
LVL 2

Author Comment

by:dramacqueen
ID: 17887967
Perfect.

Thanks lappins.  Have an EXCELLENT day!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now