我試圖在Db2中創建一個Oracle PL/SQL包,但遇到錯誤。Db2:如何在db2中部署Oracle PL/SQL包?
CREATE OR REPLACE PACKAGE ARITHMETIC AS
function add (
first number,
second number)
return number;
END ARITHMETIC;
CREATE OR REPLACE PACKAGE BODY ARITHMETIC AS
function add(
first number,
second number)
return number AS
BEGIN
return first + second;
END add;
END ARITHMETIC;
當我運行上面的代碼,它會導致以下錯誤:
Deploy [tnbdr]DB2INST1.ARITHMETIC Running DB2INST1.ARITHMETIC - Deploy for debug started. Create PL/SQL Package Specification returns SQLCODE: -104, SQLSTATE: 42601. DB2INST1.ARITHMETIC: 1: An unexpected token "PACKAGE" was found following "CREATE OR REPLACE ". Expected tokens may include:
"VIEW".. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.18.60 An unexpected token "PACKAGE" was found following "CREATE OR REPLACE ". Expected tokens may include: "VIEW".. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.18.60 DB2INST1.ARITHMETIC - Deploy for debug failed. DB2INST1.ARITHMETIC - Roll back completed successfully.
我如何部署軟件包,它爲什麼會失敗?