mysql报错Error Code: 1292. Truncated incorrect INTEGER value: 'CANBM'

电竞煤老板 2017-04-14 02:45:50
今天同事和我说程序报了个错误,就是标题那个错误,可是我看了半天也看不出有什么错误。
INSERT INTO T_search_sttl_check_data
(
STTL_MONTH ,
cust_carrier_cd ,
check_result ,
total_number ,
not_sttl_numer ,
sttl_numer ,
not_present_number ,
not_file_numer ,
not_money_numer ,
temp_file_numer ,
partner_carrier_cd_numbeR ,
DIFFER_MONTH_NUMBER )
select invs.sttl_month,invs.cust_carrier_cd,
(case when invs.inv_num-opens.open_num= 0 then '相同' else '不相同'end),
invs.inv_num,
not_sttl_numer,sttl_numer,not_present_number,not_file_numer,not_money_numer,temp_file_numer,
opens.open_num,opens.open_diff_num
from (
select v_begin_month sttl_month,
t.cust_carrier_cd,
count(*) inv_num,
count(case when t.data_status = 0 then t.partner_carrier_cd else null end) not_sttl_numer,-- 未冲销
count(case when t.data_status = 1 then t.partner_carrier_cd else null end) sttl_numer,-- 已冲销
count(case when t.data_status = 3 then t.partner_carrier_cd else null end) not_present_number,-- 账单未到
count(case when t.data_status = 2 then t.partner_carrier_cd else null end) not_file_numer,-- 文件不全
count(case when t.data_status = 6 then t.partner_carrier_cd else null end) not_money_numer,-- 金额不符
count(case when t.data_status = 4 then t.partner_carrier_cd else null end) temp_file_numer-- 文件重复
from fcsdba.accnt_invoice t
where t.sttl_month =v_begin_month
and (t.cust_carrier_cd = i_CUST_CARRIER_CD or i_CUST_CARRIER_CD is null or i_CUST_CARRIER_CD = '')
and (t.biz_pkg = i_biz_pkg or i_biz_pkg is null or i_biz_pkg = '')
and t.biz_line=2
group by t.cust_carrier_cd
) invs,
(
select cust_carrier_cd,
sum(case when sttl_month = v_begin_month then 1 else 0 end ) open_num,
sum(case when sttl_month = v_begin_month then 1 else -1 end) open_diff_num
from(
select distinct p.cust_carrier_cd,p.partner_carrier_cd,p.biz_pkg,v_begin_month sttl_month
from pubdba.partner_carriers p,pubdba.partner_open_financial_info f
where 1=1
and date_format(p.effc_tm,'%Y%m')<=v_begin_month
and date_format(p.expired_tm,'%Y%m')>=v_begin_month
and p.cust_carrier_cd=f.cust_carrier_cd
and p.partner_carrier_cd=f.partner_carrier_cd
and p.biz_pkg=f.biz_pkg
and p.roam_mode in(0,2)
and (p.biz_pkg = i_biz_pkg or i_biz_pkg is null or i_biz_pkg = '')
and (p.cust_carrier_cd = i_CUST_CARRIER_CD or i_CUST_CARRIER_CD is null or i_CUST_CARRIER_CD = '')
and date_format(f.effc_tm,'%Y%m')<=v_begin_month
and date_format(f.expired_tm,'%Y%m')>=v_begin_month
union all
select distinct p.cust_carrier_cd,p.partner_carrier_cd,p.biz_pkg,v_last_month sttl_month
from pubdba.partner_carriers p,pubdba.partner_open_financial_info f
where 1=1
and date_format(p.effc_tm,'%Y%m')<=v_last_month
and date_format(p.expired_tm,'%Y%m')>=v_last_month
and p.cust_carrier_cd=f.cust_carrier_cd
and p.partner_carrier_cd=f.partner_carrier_cd
and p.biz_pkg=f.biz_pkg
and (p.biz_pkg = i_biz_pkg or i_biz_pkg is null or i_biz_pkg='')
and (p.cust_carrier_cd = i_CUST_CARRIER_CD or i_CUST_CARRIER_CD is null or i_CUST_CARRIER_CD = '')
and p.roam_mode in(0,2)
and date_format(f.effc_tm,'%Y%m')<=v_last_month
and date_format(f.expired_tm,'%Y%m')>=v_last_month
) t group by cust_carrier_cd
) opens
where invs.cust_carrier_cd=opens.cust_carrier_cd;
...全文
1464 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
卖水果的net 2017-04-14
  • 打赏
  • 举报
回复
引用 8 楼 qq_26907711 的回复:
[quote=引用 7 楼 wmxcn2000 的回复:] [quote=引用 5 楼 qq_26907711 的回复:] 没有CANBM这个字段。
这是一个值,不是字段;[/quote] 是我查询出来的一个值要转为int类型但是它是字符串类型的是吗?[/quote] 是
电竞煤老板 2017-04-14
  • 打赏
  • 举报
回复
我找到问题了,我查询出来的一个值,或者说一个字段,他是字符串的他是他要插入到一个int类型的列里面,感谢各位的帮助。
电竞煤老板 2017-04-14
  • 打赏
  • 举报
回复
引用 7 楼 wmxcn2000 的回复:
[quote=引用 5 楼 qq_26907711 的回复:] 没有CANBM这个字段。
这是一个值,不是字段;[/quote] 是我查询出来的一个值要转为int类型但是它是字符串类型的是吗?
卖水果的net 2017-04-14
  • 打赏
  • 举报
回复
引用 5 楼 qq_26907711 的回复:
没有CANBM这个字段。
这是一个值,不是字段;
电竞煤老板 2017-04-14
  • 打赏
  • 举报
回复
最坑的是我把变量那些东西按照参数填进去,单独测试他就没有了问题。真的很奇怪。
电竞煤老板 2017-04-14
  • 打赏
  • 举报
回复
没有CANBM这个字段。
电竞煤老板 2017-04-14
  • 打赏
  • 举报
回复
我知道是转换的问题,可是我看不出来是哪里出了问题。
二月十六 2017-04-14
  • 打赏
  • 举报
回复
看看CANBM这个字段的类型,再看看存入这个字段的数据的类型。二者是不是一致。
卖水果的net 2017-04-14
  • 打赏
  • 举报
回复
Error Code: 1292. Truncated incorrect INTEGER value: 'CANBM' CANBM,这是一个字符串,要转换数值型,转换失败了。
电竞煤老板 2017-04-14
  • 打赏
  • 举报
回复
别沉了啊,自顶一个。

22,209

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧