DB2 SQL error: SQLCODE: -104, SQLSTATE: 42601, SQLERRMC

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了DB2 SQL error: SQLCODE: -104, SQLSTATE: 42601, SQLERRMC相关的知识,希望对你有一定的参考价值。

DB2 SQL error: SQLCODE: -104, SQLSTATE: 42601, SQLERRMCSQL:insert into t_zm_dhyc(ID,COMPANYID,DEPTID,WEEK,STARTWEEK,ENDWEEK,EXECUTOR,EXECUTIONTIME,KHMC,KHDZ,XKZH,PPMC,SZDH,BZDH,HQB,YY,TXRID,TXRMC,TXSJ,STATUS,REMARK,TAG,TAG2)with t1 as(
select COMPANYID,DEPTID,ORDERID,PRODUCTCODE,QUANTREQ qzsl,ISCANCEL from T_VISITSALES_ORDERDETAIL where ORDERDATE ='2009-10-19' and productid=1408
),t2 as(
select QUANTREQ bzsl from T_VISITSALES_ORDERDETAIL where ORDERDATE ='2009-10-26' and productid=1409
)select distinct 1 id, t1.COMPANYID,t1.DEPTID, 1 week,'2009-10-19' startweek,'2009-10-26' endweek,'' executor,'2009-10-19' executiontime,'' khmc, '' khdz,
'' xkzh,t1.PRODUCTCODE,t1.qzsl,t2.bzsl, (t2.bzsl/t1.qzsl)*100 hqb,'' yy,1 txrid,'' txrmc,'2009-10-26' txsj,0 status,'' remark,'' tag,'' tag2 from t1 ,t2
where (t2.bzsl/t1.qzsl)*100>150; 哪位高手帮我看看

SQLSTATE 42601: 字符、标记或子句无效或丢失。我把你的语句在我本地DB2做了一遍,修改了一下,没有问题。我执行的语句:db2 "insert into t_zm_dhyc(ID,COMPANYID,DEPTID,WEEK,STARTWEEK,ENDWEEK,EXECUTOR,EXECUTIONTIME,KHMC,KHDZ,XKZH,PPMC,SZDH,BZDH,HQB,YY,TXRID,TXRMC,TXSJ,STATUS,REMARK,TAG,TAG2) with t1 as (select COMPANYID,DEPTID,ORDERID,PRODUCTCODE,QUANTREQ qzsl,ISCANCEL from T_VISITSALES_ORDERDETAIL where ORDERDATE ='1' and productid='1'),t2 as (select QUANTREQ bzsl from T_VISITSALES_ORDERDETAIL where ORDERDATE ='1' and productid='1')select distinct '1' id, t1.COMPANYID,t1.DEPTID, '1' week,'2' startweek,'2' endweek,'' executor,'2' executiontime,'' khmc, '' khdz,'' xkzh,t1.PRODUCTCODE,t1.qzsl,t2.bzsl, t2.bzsl||t1.qzsl hqb,'' yy,'1' txrid,'' txrmc,'2' txsj,'0' status,'' remark,'' tag,'' tag2 from t1 ,t2"
查询结果: ID COMPANYID DEPTID WEEK STARTWEEK ENDWEEK EXECUTOR EXECUTIONTIME KHMC KHDZ XKZH PPMC SZDH BZDH HQB YY TXRID TXRMC TXSJ STATUS REMARK TAG TAG2-- --------- ------ ---- --------- ------- -------- ------------- ---- ---- ---- ---- ---- ---- --- -- ----- ----- ---- ------ ------ --- ----1 - - 1 2 2 2 - - - - 1 2 0 1 条记录已选择。 为了方便检查,我将所有表字段都设置为char(1)了。 从错误代码来看,请你检查一下数据库里面这两张表是否有齐你select或where的字段。
参考技术A 去掉结尾的; 参考技术B 基本语法错误

DB2 Error : SQLCODE=-802,SQLSTATE=22003 异常的原因

使用DB2时,报错为 DB2 Error : SQLCODE=-802,SQLSTATE=22003

主要原因:

是我们sql语句使用某个字段*86400后结果非常大,导致无法返回结果;因为某个字段*86400后的结果是一个整数型的数据 ,位数不能超过限定

解决的办法:

在其前面的字段加上double,这样就可以扩大数据值的范围

以上是关于DB2 SQL error: SQLCODE: -104, SQLSTATE: 42601, SQLERRMC的主要内容,如果未能解决你的问题,请参考以下文章

DB2 SQL Error: SQLCODE=-302, SQLSTATE=22001, SQLERRMC=null

sql语句报错,DB2 SQL Error: SQLCODE=-203, SQLST

DB2 Error : SQLCODE=-802,SQLSTATE=22003 异常的原因

DB2 SQL error: SQLCODE: -1585, SQLSTATE: 54048, SQLERRMC: null

DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, SQLERRMC: STAR9.T_LIANG,这个问题怎么在hibernate中如

DB2 SQL 错误:SQLCODE=-204,SQLSTATE=42704