0

I want to create a very simple stored procedure that will only take several IN parameters and insert them into a table. To learn how to do it, I went to CREATE PROCEDURE (SQL) statement

From that I gathered that the procedure below should work, but it does not:

CREATE PROCEDURE A (IN B INT)
LANGUAGE SQL
BEGIN
  INSERT INTO TA(A) VALUES(B);
END

The error is:

An unexpected token "END-OF-STATEMENT" was found following "INTO TA(A) VALUES(B)".  Expected tokens may include:  "<psm_semicolon>".. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.19.80 SQL Code: -104, SQL State: 42601
Error occurred in:
CREATE PROCEDURE A (IN B INT)
LANGUAGE SQL
BEGIN
INSERT INTO TA(A) VALUES(B)

When I copied the source code above from SquirrelSQL and pasted it into a new query in IBM Data Studio, it indeed underscored the semicolon at the end of the INSERT statement and displayed the error:

DB2 for Linux, UNIX, and Windows: ";" is invalid.

If I comment out the procedure body, it compiles fine, and I can call it successfully.

I googled a lot but could not find any material difference between my code and the suggestions found, including here and on SO. Even when I took the sample procedure from the linked page, it did not compile. It throws the error:

"MEDIANSALARY" is not valid in the context where it is used.. SQLCODE=-206, SQLSTATE=42703, DRIVER=4.19.80 SQL Code: -206, SQL State: 42703
Error occurred in:
SET medianSalary = 0
0