Solved

Oracle Package body problem - major headache

Posted on 2006-11-07
2
660 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.

737 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