3

我正在开发 IBM iseries v6r1m0 系统。

我正在尝试执行一个非常简单的查询:

select * from XG.ART where DOS = 998 and (DES like 'ALB%' or DESABR like 'ALB%')

这些列是:

DOS -> numeric (3,0)
DES -> Graphic(80) CCSID 1200
DESABR -> Garphic(25) CCSID 1200

我得到:

SQL State : 58004
SQL Code : -901
Message : [SQL0901] SQL System error. 
Cause . . . . . :  An SQL system error has occurred. The current SQL statement cannot be completed successfully. The error will not prevent other SQL statements from being processed. Previous messages may indicate that there is a problem with the SQL statement and SQL did not correctly diagnose the error. The previous message identifier was CPF4204. Internal error type 3107 has occurred. If precompiling, processing will not continue beyond this statement.
Recovery . . . : See the previous messages to determine if there is a problem with the SQL statement. To view the messages, use the DSPJOBLOG command if running interactively, or the WRKJOB command to view the output of a precompile. An application program receiving this return code may attempt further SQL statements. Correct any errors and try the request again.

如果我将 DES 更改为 REF(图形(25)),它可以工作......

编辑 :

今天下午我进行了一些测试,这很奇怪:

在创建表/索引之后,我没有错误。

  • 如果我插入一些数据:错误
  • 如果我清除表格:错误
  • 如果我删除索引(见下文):它可以工作(有或没有数据)!

指数为:

create index XG.GTFAT_ART_B on XG.ART(
DOS,
DESABR,
ART_ID
)

编辑 2:

这是工作日志(对不起,它是法语...) 工作日志

它说:

Function error X'1720' in machine instruction. Internal snapshot ID 01010054
Foo file created in library QTEMP.
*** stuff with the printer
DBOP *** FAILED open. Exception from call to SLIC$
Internal error in the query processor file
Sql system error
4

4 回答 4

2

我终于联系了 IBM。

这是 v5 中的一个旧错误。

我已经安装了最新的 PTF,现在它可以工作了。

于 2012-07-12T17:38:48.260 回答
0

您需要使用GRAPHIC标量函数来转换LIKE谓词上的字符文字。

CREATE TABLE QTEMP/TEST (F1 GRAPHIC(80))
INSERT INTO QTEMP/TEST (F1) VALUES (GRAPHIC('TEST'))
SELECT * FROM QTEMP/TEST WHERE F1 LIKE GRAPHIC('TE%')
于 2012-06-26T02:59:58.700 回答
0

我知道这个人通过更新解决了他的问题。但这里有一些对我有用的东西,可能对这里有问题的下一个人有用。

我的问题查询有很多公用表表达式。他们中的大多数人没有创建包含大量记录的表。因此,如果我认为 CTE 最多可以创建 1000 条记录,我会在其中添加“仅获取前 9999 行”。我知道 CTE 不可能有比这更多的行。我猜查询优化器对添加的考虑更少。

如果您有这个问题并且您没有升级或与 IBM 交谈的选项,我希望这对您有所帮助。

于 2013-04-15T22:06:52.837 回答
0

对于遇到此错误的其他人,我在 IBM i 系列 v7r3 上遇到它,当UPDATE尝试SELECT使用DISTINCT. 我解决了在内部 SELECT 末尾删除DISTINCT和添加的问题。FETCH FIRST 1 ROW ONLY

例如:从

UPDATE MYTABLE AS T1  
SET T1.FIELD1 = (
    SELECT DISTINCT T2.FIELD5
    FROM MYTABLE AS T2       
    WHERE T1.FIELD2 = T2.FIELD2
      AND T1.FIELD3 = T2.FIELD3
    )
WHERE T1.FIELD4 = 'XYZ'

UPDATE MYTABLE AS T1  
SET T1.FIELD1 = (
    SELECT T2.FIELD5
    FROM MYTABLE AS T2       
    WHERE T1.FIELD2 = T2.FIELD2
      AND T1.FIELD3 = T2.FIELD3
    FETCH FIRST 1 ROW ONLY
    )
WHERE T1.FIELD4 = 'XYZ'
于 2017-04-06T13:26:18.877 回答