[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Oracle Package body problem - major headache

Posted on 2006-11-07
2
Medium Priority
?
664 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 1000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
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…
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
Suggested Courses

867 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