Reputation: 2821
CREATE OR REPLACE PACKAGE packet AS
TYPE tip IS RECORD(a1 INT,a2 VARCHAR2(20));
FUNCTION getrow return tip;
PROCEDURE setrow(v tip);
END packet;
/
CREATE OR REPLACE PACKAGE BODY packet AS
PROCEDURE setrow(v tip) IS
BEGIN
dbms_output.put_line('kikkkk');
END;
end packet;
I keep getting : Warning: execution completed with warning
and the procedure can`t be called:
*Error report: ORA-04063: package body "IRT.PACKET" has errors ORA-06508: PL/SQL: could not find program unit being called:
"IRT.PACKET" ORA-06512: at line 7
04063. 00000 - "%s has errors"
*Cause: Attempt to execute a stored procedure or use a view that has errors. For stored procedures, the problem could be syntax errors or references to other, non-existent procedures. For views, the problem could be a reference in the view's defining query to a non-existent table. Can also be a table which has references to non-existent or inaccessible types.
Action: Fix the errors and/or create referenced objects as necessary.
Upvotes: 0
Views: 9734
Reputation: 17538
You must define the function GETROW
in the package body that you declared in the package specification.
That will enable your package to compile and then you should be able to call it.
This compiled for me when I added GETROW
CREATE OR REPLACE PACKAGE packet
AS
TYPE tip IS RECORD(
a1 INT,
a2 VARCHAR2( 20 )
);
FUNCTION getrow
RETURN tip;
PROCEDURE setrow( v tip );
END packet;
/
CREATE OR REPLACE PACKAGE BODY packet
AS
FUNCTION getrow
RETURN tip
IS
v_tip tip;
BEGIN
v_tip.a1 := 1;
v_tip.a2 := 'test';
RETURN v_tip;
END;
PROCEDURE setrow( v tip )
IS
BEGIN
DBMS_OUTPUT.put_line( 'kikkkk' );
END;
END packet;
Upvotes: 3
Reputation: 146219
In the SQL Developer worksheet you can run this query:
select * from user_errors
This will give you the following results:
NAME | TYPE |SEQUENCE |LINE |POSITION |TEXT ATTRIBUTE |MESSAGE_NUMBER
--------+--------------+---------+-----+---------+------------------------------------------------+--------------
PACKET | PACKAGE BODY | 1 | 3 | 13 |PLS-00323: subprogram or cursor 'GETROW' is decl| ERROR 323
|ared in a package specification and must be defi
|ned in the package body
As you can see, this makes it easy to discover your bloomer: you haven't defined GETROW in the package body. Adding a stub like this will allow the package to compile:
FUNCTION getrow
return tip
IS
rv tip;
BEGIN
return rv;
END;
Upvotes: 3