Ihave created procedures in a package... While compiling in TOAD, there were no errors but after submitting my jsp page it is showing that
""package body "USERINFO.FORM_PKG" has errors ORA-06508: PL/SQL: could not find program unit being called: "USERINFO.FORM_PKG"""
CREATE OR REPLACE PACKAGE form_pkg AS -- package body
PROCEDURE Insert_receipts(
p_receipt NUMBER,
p_transaction NUMBER,
p_amount NUMBER);
PROCEDURE Insert_stkqntys(
p_itemid NUMBER,
p_date VARCHAR2,
p_supplier VARCHAR2,
p_type VARCHAR2,
p_transaction NUMBER,
p_quantity NUMBER);
END form_pkg;
/
CREATE OR REPLACE PACKAGE BODY form_pkg AS -- package body
PROCEDURE Insert_receipts (
p_receipt NUMBER(6),
p_transaction NUMBER(5),
p_amount NUMBER(10),
seq_value NUMBER) IS
BEGIN
INSERT INTO receipt
( ID, Receipt_Number,Transaction_ID,Amount)
VALUES (seq.nextval, p_receipt, p_transaction, p_amount);
END Insert_receipts
;
PROCEDURE Insert_stkqntys
(
p_itemid NUMBER(8),
p_date VARCHAR2(50),
p_supplier VARCHAR2(50),
p_type VARCHAR2(50),
p_transaction NUMBER(8),
p_quantity NUMBER,
seq_value NUMBER) IS
BEGIN
INSERT INTO stock_quantity(ID,Item_ID,Date_Received,Supplier_Challan,Transaction_Type,Transaction_ID,Quantity)VALUES (seq.nextval, p_itemid, p_date,p_supplier,p_type,p_transaction,p_quantity);
END Insert_stkqntys;
End form_pkg;
/
The package specification and body should have the same arguments/data types for each procedure/function and cannot include a size/scale/precision.
Also, use [SCHEMA_NAME.]TABLE_NAME.COLUMN_NAME%TYPE
rather than explicitly declaring the types. However, if you are going to use the underlying data types then just remove the precision. I.e. p_receipt NUMBER(6)
should just be p_receipt NUMBER
without the size/scale/precision.
CREATE OR REPLACE PACKAGE form_pkg AS -- package specification
PROCEDURE Insert_receipts(
p_receipt RECEIPT.RECEIPT_NUMBER%TYPE,
p_transaction RECEIPT.TRANSACTION_ID%TYPE,
p_amount RECEIPT.AMOUNT%TYPE
);
PROCEDURE Insert_stkqntys(
p_itemid STOCK_QUANTITY.ITEM_ID%TYPE,
p_date STOCK_QUANTITY.DATE_RECEIVED%TYPE,
p_supplier STOCK_QUANTITY.SUPPLIER_CHALLAN%TYPE,
p_type STOCK_QUANTITY.TRANSACTION_TYPE%TYPE,
p_transaction STOCK_QUANTITY.TRANSACTION_ID%TYPE,
p_quantity STOCK_QUANTITY.QUANTITY%TYPE
);
END form_pkg;
/
CREATE OR REPLACE PACKAGE BODY form_pkg AS -- package body
PROCEDURE Insert_receipts (
p_receipt RECEIPT.RECEIPT_NUMBER%TYPE,
p_transaction RECEIPT.TRANSACTION_ID%TYPE,
p_amount RECEIPT.AMOUNT%TYPE
)
IS
BEGIN
INSERT INTO receipt (
ID,
Receipt_Number,
Transaction_ID,
Amount
) VALUES (
seq.nextval,
p_receipt,
p_transaction,
p_amount
);
END Insert_receipts;
PROCEDURE Insert_stkqntys
(
p_itemid STOCK_QUANTITY.ITEM_ID%TYPE,
p_date STOCK_QUANTITY.DATE_RECEIVED%TYPE,
p_supplier STOCK_QUANTITY.SUPPLIER_CHALLAN%TYPE,
p_type STOCK_QUANTITY.TRANSACTION_TYPE%TYPE,
p_transaction STOCK_QUANTITY.TRANSACTION_ID%TYPE,
p_quantity STOCK_QUANTITY.QUANTITY%TYPE
)
IS
BEGIN
INSERT INTO stock_quantity(
ID,
Item_ID,
Date_Received,
Supplier_Challan,
Transaction_Type,
Transaction_ID,
Quantity
) VALUES (
seq.nextval,
p_itemid,
p_date,
p_supplier,
p_type,
p_transaction,
p_quantity
);
END Insert_stkqntys;
End form_pkg;
/