我想創建一個包含四個函數的包。每個功能將添加一組數字並從總數中減去一組。我的語法正確無誤。下面的函數自己工作,我試着在最後調用第一個函數。功能/軟件包問題PL/SQL
當試圖創建包我得到其中在第7行,「出現符號‘END一個錯誤’在需要下列之一時:開始功能編譯程序亞型類型當前光標刪除存在現有0.05秒」
在包體中它說「名稱已被現有對象使用」。我不明白,因爲它必須在包的規範中聲明,創建或替換應該解決這個問題,如果錯誤是已經有一個名爲functionbyfour的包。最後,當我嘗試在包中使用函數時,它表示在遇到下列其中一項時遇到符號「BEGIN」::=。(@%; not null範圍默認字符符號「;」 「替換爲」BEGIN「以繼續ORA-06550:第5行,第43列:PLS-00103:遇到下列其中一項時遇到符號」FROM「:(*%& = - +; < /> at在國防部是不餘REM <>或!=或〜=> = < = <>和或類似LIKE2樣4 likec我使用Oracle快捷版11g和相信新的PL ||之間的多重集我」。
/SQL(4周)。
任何輸入,非常感謝。
CREATE OR REPLACE FUNCTION functionbyfour AS
FUNCTION functone(first number, second number) RETURN NUMBER ;
FUNCTION functtwo(first number, second number, third number) RETURN NUMBER ;
FUNCTION functthree(first number, second number, third number, fourth number) RETURN NUMBER ;
FUNCTION functfour(first number, second number, third number, fourth number,fifth number) RETURN NUMBER ;
END functionbyfour;
/
CREATE OR REPLACE PACKAGE functionbyfour AS
FUNCTION functone (first number, second number) RETURN number AS total number;
BEGIN
total:=first + second – 1;
RETURN total;
DBMS_OUTPUT.PUT_LINE(total);
END functone;
FUNCTION functtwo (first number, second number, third number) RETURN number AS total number;
BEGIN
total:=first + second + third – 1;
RETURN total;
DBMS_OUTPUT.PUT_LINE(total);
END functtwo;
FUNCTION functthree (first number, second number,third number, fourth number) RETURN number AS total number;
BEGIN
total:=first + second + third + fourth – 1;
RETURN total;
DBMS_OUTPUT.PUT_LINE(total);
END functthree;
FUNCTION functfour (first number, second number, third number, fourth number, fifth number) RETURN number AS total number;
BEGIN
total:=first + second + third + fourth + fifth – 1;
RETURN total;
DBMS_OUTPUT.PUT_LINE(total);
END functfour;
/
BEGIN
SELECT functionbyfour.functone(1,2) FROM DUAL;
END;
/
感謝您的輸入,不確定關於第二個關鍵字,(它沒有突出顯示,它似乎工作)。它是一項任務,誰知道教授的想法是什麼?你的代碼看起來更容易,但他說他想要一個包含四個函數的包,所以我不會和他爭論。 –
是的,當我說「不行」時,如果您打開plsql警告並檢查用戶錯誤,我應該說「不應該」,您將得到警告PLW-06010:關鍵字「SECOND」用作定義的名稱 – Dave