我正在使用Oracle 10g Express版本。由於函數體在Oracle中的編譯錯誤而創建的包體
這裏是我包創建代碼: -
CREATE OR REPLACE PACKAGE ticketBooking
AS
PROCEDURE bookOrder(id IN NUMBER, key IN VARCHAR2, fname IN VARCHAR2, lname IN VARCHAR2, age IN NUMBER, address IN VARCHAR2, adate IN VARCHAR2, status OUT NUMBER);
PROCEDURE bookTicket(id IN NUMBER, orderID IN NUMBER, mID IN NUMBER, mRow IN NUMBER, mSeat IN NUMBER, mDate IN VARCHAR2, mTime IN NUMBER, status OUT NUMBER);
FUNCTION maxOrderID RETURN NUMBER;
FUNCTION maxTransactionID RETURN NUMBER;
END ticketBooking;
/
現在,這裏是包體創作: -
CREATE OR REPLACE PACKAGE BODY ticketBooking
IS
PROCEDURE
bookOrder (id IN NUMBER, key IN VARCHAR2, fname IN VARCHAR2, lname IN VARCHAR2, age IN NUMBER, address IN VARCHAR2, adate IN VARCHAR2, status OUT NUMBER)
IS
BEGIN
INSERT INTO tbl_order (order_id, order_key, order_fname, order_lname, order_age, order_address, order_add_date)
VALUES (id, key, fname, lname, age, address, TO_DATE(adate, 'YYYY-MM-DD hh24:mi:ss'));
status := 1;
EXCEPTION
WHEN OTHERS THEN
status := 0;
END bookOrder;
PROCEDURE
bookTicket (id IN NUMBER, orderID IN NUMBER, mID IN NUMBER, mRow IN NUMBER, mSeat IN NUMBER, mDate IN VARCHAR2, mTime IN NUMBER, status OUT NUMBER)
IS
BEGIN
INSERT INTO tbl_transaction (transaction_id, order_id, movie_id, movie_row, movie_seat, movie_date, movie_time)
VALUES (id, orderID, mID, mRow, mSeat, mDate, mTime);
status := 1;
EXCEPTION
WHEN OTHERS THEN
status := 0;
END bookTicket;
FUNCTION
maxOrderID RETURN NUMBER
IS
mOID NUMBER:=0;
BEGIN
SELECT CASE WHEN MAX(order_id) > 0 THEN MAX(order_id) ELSE 0 END INTO mOID FROM tbl_order;
return (mOID);
END maxOrderID;
FUNCTION
maxTransactionID RETURN NUMBER
IS
mTID NUMBER:=0;
BEGIN
SELECT CASE WHEN MAX(transaction_id) > 0 THEN MAX(transaction_id) ELSE 0 END INTO mTID FROM tbl_transaction;
return (mTID);
END maxTransactionID;
END ticketBooking;
/
我得到那個包體與編譯錯誤創建一個錯誤。 我在做什麼錯? 當我刪除功能,那時沒有警告或編譯錯誤顯示。
或查詢'user_errors'視圖,你可以看到什麼實際的編譯錯誤是。 –