0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【SAP HANA SQLScript】SAP DBTech JDBC: [1281]: wrong number or types of parameters in call:

Last updated at Posted at 2023-02-20

エラーメッセージ例

Could not execute 'call プロシージャ名(引数1, 引数2)'
SAP DBTech JDBC: [1281]: wrong number or types of parameters in call: テーブル名 is not bound: line 1 col 6 (at pos 5)

発生箇所

独自に定義したプロシージャの戻り値(OUT)にテーブルを指定したにもかかわらず、呼び出すときに戻り値のテーブルを指定しないと発生した。

-- プロシージャ側
CREATE OR REPLACE foo(
    IN a INT,
    IN b INT, 
    OUT outtable TABLE(i INTEGER, c VARCHAR(3))
)AS BEGIN 
/* 処理 */
END;

--呼び出し側
-- NG
DO
BEGIN
call foo(1, 2); -- 引数に戻り値のテーブルを指定していない
END;

-- OK
DO
BEGIN
DECLARE outtable TABLE(i INTEGER, c VARCHAR(3));
CALL foo(1, 2, outtable); -- Table Variableを宣言して引数に指定
END; 

ちなみに中身を確認するには

SELECT * FROM :outtable;

をCALLした後に呼べば見れる。

プロシージャ共通のお決まりなのか、HANA特有かは分かりません。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?