Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 21st, 2004, 04:17 PM
kelvin-c kelvin-c is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 57 kelvin-c User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 h 25 m 54 sec
Reputation Power: 5
PL/SQL Package error

hi,
i am trying to make a PACKAGE of Precedures :

Code:
CREATE OR REPLACE PACKAGE BODY propk
IS

 PROCEDURE maanedloenn
IS
 v_mloenn  NUMBER(8);
 CURSOR c1 IS
 SELECT ansnr, navn, timeloenn
 FROM   ansatt;
 v_c1 c1%ROWTYPE;
 BEGIN
 OPEN c1;
 LOOP
            FETCH c1 INTO v_c1;
            EXIT WHEN c1%NOTFOUND;
            v_mloenn := v_c1.timeloenn*0.6*7*30;
            DBMS_OUTPUT.PUT_LINE(v_c1.ansnr || ' ' || v_c1.navn || ' ' || v_mloenn);

 END LOOP;
 CLOSE c1;
 END maanedloenn;

END propk;
/


i get this error :
Code:
LINE/COL ERROR
-------- -----------------------------------------------------------------
0/0      PL/SQL: Compilation unit analysis terminated
1/14     PLS-00905: object myUserName.PROPK is invalid
1/14     PLS-00304: cannot compile body of 'PROPK' without its
         specification

i dont understand why it wont compile

Reply With Quote
  #2  
Old October 21st, 2004, 05:15 PM
hedge hedge is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2002
Posts: 693 hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 4 Days 23 h 47 m 32 sec
Reputation Power: 20
a package is defined with the package as well as the package body. the package defines the public interface (like prototypes of the procs) whereas the body defines the actual procedures.

so you need something like
Code:
create or replace package myPkg
 proc1(parm1 in number);
end myPkg;

create or replace package body myPkg
   procedure proc1(parm1 in number) is
   begin
     null;
  end proc1;
end myPkg;


this should give you the idea, I doubt it will compile as is and I don't have access to Oracle at the moment to check it.

Reply With Quote
  #3  
Old October 21st, 2004, 05:43 PM
kelvin-c kelvin-c is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 57 kelvin-c User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 h 25 m 54 sec
Reputation Power: 5
hello hedge,

Code:
CREATE OR REPLACE PACKAGE propk
IS
PROCEDURE maanedloenn;
END propk;

CREATE OR REPLACE PACKAGE BODY propk
IS

 PROCEDURE maanedloenn
IS
 v_mloenn  NUMBER(8);
 CURSOR c1 IS
 SELECT ansnr, navn, timeloenn
 FROM   ansatt;
 v_c1 c1%ROWTYPE;
 BEGIN
 OPEN c1;
 LOOP
    FETCH c1 INTO v_c1;
    EXIT WHEN c1%NOTFOUND;
    v_mloenn := v_c1.timeloenn*0.6*7*30;
     DBMS_OUTPUT.PUT_LINE(v_c1.ansnr || ' ' || v_c1.navn || ' ' || v_mloenn);

 END LOOP;
 CLOSE c1;
 END maanedloenn;

END propk;
/


now i get this error :
Code:
Errors for PACKAGE PROPK:

LINE/COL ERROR
-------- -----------------------------------------------------------------
6/1      PLS-00103: Encountered the symbol "CREATE"

i think i have the correct syntax.
i have no idea what it tries to say..

Reply With Quote
  #4  
Old October 22nd, 2004, 03:26 AM
kelvin-c kelvin-c is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 57 kelvin-c User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 h 25 m 54 sec
Reputation Power: 5
ok.. i have found out :
http://forums.devshed.com/showthread.php?t=167025

thank you for your help

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > PL/SQL Package error


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT