DB2 SQL error: SQLCODE: -104, SQLSTATE: 42601, SQLERRMC
DB2SQLerror:SQLCODE:-104,SQLSTATE:42601,SQLERRMCSQL:insertintot_zm_dhyc(ID,COMPANYID,...
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; 哪位高手帮我看看 展开
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; 哪位高手帮我看看 展开
3个回答
2013-03-29
展开全部
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的字段。
查询结果: 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的字段。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询