Solved

Oracle Package body problem - major headache

Posted on 2006-11-07
2
658 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:
Stephen Lappin 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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

828 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