I tried to create an Oracle PL/SQL package in Db2, but ran into errors.
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;
When I run the above code, it results in the following error:
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.
How can I deploy the package, why is it failing?