Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

package body compilation error 1

Status
Not open for further replies.

tezeey

Vendor
Oct 11, 2009
5
NA
This package is compiling with a warning,i have been trying to fix the error but i'm having difficulties locating them.

please help.
.
/* CREATES PACKAGE BODY*/
CREATE OR REPLACE PACKAGE BODY INVENTORY

PROCEDURE MENU(
MESSAGE1 OUT VARCHAR2
MESSAGE2 OUT VARCHAR2
MESSAGE3 OUT VARCHAR2
MESSAGE4 OUT VARCHAR2
MESSAGE5 OUT VARCHAR2)IS

BEGIN

MESSAGE1=:'TO INSERT VALUES INTO TYPE_OF_USER TABLE INVOKE ADD_USER_TYPE PROCEDURE';
DBMS_OUTPUT.PUT_LINE(MESSAGE1);

MESSAGE2=:'TO INSERT VALUES INTO USERS INVOKE ENTER_USERS PROCEDURE';
DBMS_OUTPUT.PUT_LINE(MESSAGE2);

MESSAGE3=:'TO INSERT VALUES INTO EQUIPMENTS TABLE INVOKE ENTER_ITEMS PROCEDURE';
DBMS_OUTPUT.PUT_LINE(MESSAGE3);

MESSAGE4=:'TO INSERT VALUES INTO BORROWED_EQUIPMENTS TABLE INVOKE BORROW_RETURN_ITEM PROCEDURE';
DBMS_OUTPUT.PUT_LINE(MESSAGE4);

MESSAGE5=:'TO INSERT VALUES INTO UPDATES INVOKE MAKE_UPDATES PROCEDURE';
DBMS_OUTPUT.PUT_LINE(MESSAGE5);

END MENU;

PROCEDURE ADD_USER_TYPE(

USER_NAME VARCHAR2,
USER_TYPE VARCHAR2)
IS

BEGIN

INSERT INTO TYPE_OF_USER
VALUES(
USER_NAME,
USER_TYPE);

COMMIT;
END ADD_USER_TYPE;

PROCEDURE ENTER_USERS /*CREATE A PROCEDURE THAT INSERTS VALUES IN USSERS TABLE*/
(LAST_NAME VARCHAR2
,FIRST_NAME VARCHAR2
,EMAIL VARCHAR2
,USER_NAME VARCHAR2
,TYPE_OF_USER VARCHAR2
,PIN VARCHAR2)IS

BEGIN
INSERT INTO USERS
VALUES(LAST_NAME
,FIRST_NAME
,EMAIL
,USER_NAME
,TYPE_OF_USER
,PIN );
COMMIT;
END ENTER_USERS;


PROCEDURE ENTER_ITEMS /*CREATE A PROCEDURE THAT INSERTS VALUES IN EQUIPMENTS TABLE*/
(EQUIPMENT_NAME VARCHAR2
,USER_NAME VARCHAR2
,USER_TYPE VARCHAR2
,PIN VARCHAR2
,DESCRIPTION VARCHAR2
,ON_HAND NUMBER
)IS

BEGIN

INSERT INTO EQUIPMENTS
VALUES(EQUIPMENT_NAME
,USER_NAME
,USER_TYPE
,PIN
,DESCRIPTION
,ON_HAND)
COMMIT;
END ENTER_ITEMS;

PROCEDURE BORROW_RETURN_ITEM(
EQUIPMENT_NAME VARCHAR2,
USER_NAME VARCHAR,
DATE_BORROWED DATE,
DATE_RETURNED DATE,
USER_TYPE VARCHAR2,
PIN VARCHAR2)IS

BEGIN

INSERT INTO BORROWED_EQUIPMENTS
VALUES(
EQUIPMENT_NAME,
USER_NAME ,
DATE_BORROWED,
DATE_RETURNED,
USER_TYPE ,
PIN);
COMMIT;

END BORROW_RETURN_EQUIPMENTS;

PROCEDURE MAKE_UPDATES(
EQUIPMENT_NAME VARCHAR2,
USER_NAME VARCHAR2,
USER_TYPE VARCHAR2,
PIN varchar2,
PARTY_RESPONSIBLE VARCHAR2,
UPDATE_DATE DATE,
REPLACEMENT_DATE DATE) IS

BEGIN

INSERT INTO UPDATES
VALUES(
EQUIPMENT_NAME,
USER_NAME ,
USER_TYPE ,
PIN ,
PARTY_RESPONSIBLE,
UPDATE_DATE ,
REPLACEMENT_DATE

COMMIT;
END MAKE_UPDATE;

END INVETORY;
 
Run:

select * from user_errors
where name = 'INVENTORY'

If you're using SQL*Plus, you can also use:

show errors

immediately after compiling the package.
 
A couple of points:

a) You have "END INVETORY", which doesnn't match the package name INVENTORY.

b) You are using parameter names that look as if they will probably be the same as the column names on the table. This will cause confusion as Oracle will think you are referring to the column name rather than the parameter name. I suggest you prefix all your parameter names with something like p_ e.g.

PROCEDURE BORROW_RETURN_ITEM(
P_EQUIPMENT_NAME VARCHAR2,
P_USER_NAME VARCHAR,
...

c) It's good practice with an insert statement to include the column names in case the order of the columns varies between systems e.g.

INSERT INTO UPDATES
(EQUIPMENT_NAME,
USER_NAME ,
USER_TYPE ,
PIN,
...)
VALUES(
P_EQUIPMENT_NAME,
P_USER_NAME ,
P_USER_TYPE ,
P_PIN ,
...)


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top