私はV7R1のSystem i上のSQL関数を作成していますシステム内の関数を作成するとき:エラーSQL0104私V7R1
CREATE FUNCTION MYSCHEMA.GROUPDIBAS(v_code VARCHAR(50))
RETURNS VARCHAR(2048)
LANGUAGE SQL
BEGIN
DECLARE str VARCHAR(2048);
SET str = '';
FOR row AS (
SELECT
FIELD2
FROM MYSCHEMA.DIBAS
WHERE FIELD1 = v_code
)
DO
SET str = 'Bubi'; --I removed many statements to make clear the problem doesn't come from them
END FOR;
RETURN str;
END
;
は、私は、iSeriesナビゲーターの一部である "ファイル名を指定して実行SQLスクリプト" ツール、とそれを実行しますV7R1。 これは、別のV7R1サーバー(iSeriesナビゲーターV5R4を使用)上で動作しますが、現在作業しているV7R1サーバーでは動作しません。これは、このメッセージで失敗します。
SQL State: 42601
Vendor Code: -104
Message: [SQL0104] Token <END-OF-STATEMENT> was not valid. Valid tokens: ;.
Cause . . . . . : A syntax error was detected at token <END-OF-STATEMENT>.
Token <END-OF-STATEMENT> is not a valid token. A partial list of valid tokens is ;.
This list assumes that the statement is correct up to the token.
The error may be earlier in the statement, but the syntax of the statement appears to be valid up to this point.
Recovery . . . : Do one or more of the following and try the request again:
-- Verify the SQL statement in the area of the token <END-OF-STATEMENT>. Correct the statement.
The error could be a missing comma or quotation mark, it could be a misspelled word, or it could be related to the order of clauses.
-- If the error token is <END-OF-STATEMENT>, correct the SQL statement because it does not end with a valid clause.
私はFOR
ブロックを削除した場合、それが動作します。
また、5250エミュレータでコマンドを実行すると、STRSQLコマンドが実行されます。だからは "Run SQL script"クライアントのバグのようです。
ご了承ください。
私がテストしたV7R1システムは、レベル4のSF99701を持っています。 – jamesallman