Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql IBMDB2简单查询错误901-系统错误_Sql_Db2_Ibm Midrange - Fatal编程技术网

Sql IBMDB2简单查询错误901-系统错误

Sql IBMDB2简单查询错误901-系统错误,sql,db2,ibm-midrange,Sql,Db2,Ibm Midrange,我正在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

我正在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
您需要使用标量函数来转换谓词上的字符文本

CREATE TABLE QTEMP/TEST (F1 GRAPHIC(80))
INSERT INTO QTEMP/TEST (F1) VALUES (GRAPHIC('TEST'))
SELECT * FROM QTEMP/TEST WHERE F1 LIKE GRAPHIC('TE%')

我最后联系了IBM

这是v5中的一个老bug


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

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

我的问题查询有很多常用的表表达式。他们中的大多数人并没有创建包含大量记录的表。因此,如果我计算出一个CTE最多可以生成1000条记录,我会在其中添加一个“仅获取前9999行”。我知道CTE不可能有比这更多的行。我猜查询优化器没有那么多的考虑与添加


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

对于其他遇到此错误的人,我在IBM I系列v7r3上遇到过此错误,当尝试
更新时,使用内部
选择
检索字段上要设置的值,其中多个结果减少为1,使用
不同的
。我解决了删除
DISTINCT
并在内部SELECT末尾添加
FETCH FIRST 1 ROW
的问题

例如:从

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'


您不必包装
DESABR
?确认会很好,但我假设您正在更改dds文件。听起来好像在
DES
@X-Zero中可能有某种无效/奇怪的数据:你说的wrap-DESABR是什么意思?我添加了一些信息…表的创建脚本是什么?我想说的是,您是必须更改
DESABR
的定义才能使事情正常进行,还是仅更改
DOS
。通过您的示例,我了解了insert语句:SQL State:57017 SQL code:-332消息:[SQL0332]CCSID 1147和CCSID 1147之间的字符转换incorrect@Xavinou我不知道你的工作已经在DBCS了。您可以在SQL0901错误之前包含作业日志吗?诊断消息应提供问题所在的线索。@Xavinou这是系统许可内部代码中的故障。我建议确保您的CUME和组PTF是最新的,如果问题仍然存在,请联系IBM支持。您需要安装什么PTF?
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'