|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 ![]() |
|
#2
|
|||
|
|||
|
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. |
|
#3
|
|||
|
|||
|
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.. ![]() |
|
#4
|
|||
|
|||
|
ok.. i have found out :
http://forums.devshed.com/showthread.php?t=167025 thank you for your help ![]() |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > PL/SQL Package error |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|