English 中文(简体)
Error0104 创建i V7R1系统的功能
原标题:Error SQL0104 when creating a function in System i V7R1

I m 建立系统i V7R:

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
;

I execute it with "Run SQL script" tool, which is part of the iSeries Navigator V7R1. It works on another V7R1 server (using iSeries Navigator V5R4), but not in that one where I m working now. It fails with this message:

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——一起执行声明,该声明就发挥了作用。 因此,网站 Seems as a bug in “Rkouun script”的客户。

Any hint will be appreciated!

最佳回答

鉴于@ James的测试 和我一样,我担心这个问题可能出现在。 临时“FixWRKPTFGRP 指挥,我可以猜测这支警察工作队小组:

PTF group  Level  Text
SF99701        5  DB2 FOR IBM I

Unfortunately I can t try installing it now :(.

问题回答

问题在于。 查询分析仪在下述情况下不一致:<编码> 用户名称:CURSOR FOR是任择性的,而且当需要时,即使文件表明没有具体指明独特的曲线名称。 通过IBM“利用航道”发射的电梯需要。

“FOR

括号也是不正确的,但有时是被接受的(SPSQL、纳格托·鲁克文),有时是 t(DBVisualizer/JDBC)。

TIL,根据查询来源,必须有不同的查询分析仪。

CREATE FUNCTION MYSCHEMA.GROUPDIBAS(v_code VARCHAR(50))
RETURNS VARCHAR(2048)
LANGUAGE SQL
BEGIN
    DECLARE str VARCHAR(2048);
    SET str =   ;
    FOR row AS C1 CURSOR FOR
        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

“query1”/

“query2”/

在其届会上,电离层电离层电离层扰动的特性更改了<条码> 声明-Sparator/code> 外地价值,从<条码>改为<条码> > > 。 然后使用/code>而不是;。 这样,你就可以发言或程序或职能。

usage example,
CREATE FUNCTION MYSCHEMA.GROUPDIBAS(v_code VARCHAR(50))
RETURNS VARCHAR(2048)
LANGUAGE SQL
BEGIN
    DECLARE str VARCHAR(2048);
    SET str =   ;
    FOR row AS C1 CURSOR FOR
        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 |




相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

难以执行 REGEXP_SUBSTR

I m 查询Oracle 10g。 我有两张表格(样本数据见下文)。 i m 试图提取一些领域

SQL Query Shortcuts

What are some cool SQL shorthands that you know of? For example, something I learned today is you can specify to group by an index: SELECT col1, col2 FROM table GROUP BY 2 This will group by col2

PHP array callback functions for cleaning output

I have an array of output from a database. I am wondering what the cleanest way to filter the values is example array Array ( [0] => Array ( [title] => title 1 ...

OracleParameter and DBNull.Value

we have a table in an Oracle Database which contains a column with the type Char(3 Byte). Now we use a parameterized sql to select some rows with a DBNull.Value and it doesn t work: OracleCommand ...

Running numbers in SQL

I have a SQL-statement like this: SELECT name FROM users WHERE deleted = 0; How can i create a result set with a running number in the first row? So the result would look like this: 1 Name_1 2 ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...