您的位置:首页 > 产品设计 > UI/UE

Mysql报错---Data truncation: Truncated incorrect DOUBLE value: 'C'

2018-01-10 15:06 399 查看
原来的sql

INSERT INTO tbl_receivable_list (
id,
POLICYID,
PRODUCTID,
FEETYPE,
INSURERID,
PREMIUM,
COMMIRATE,
COMMIAMOUNT,
CHARGEBILLID,
MARK,
REMARK,
applicant,
applicantname,
insured,
insuredname,
endorseno,
policyno,
agentid,
orgid,
createdate,
applicanttime,
afterTaxPremium,
pay_time
) SELECT
REPLACE (UUID(), "-", ""),
source.policyid,
source.productid,
source.fee_type,
source.insurerid,
source.premium,
source.commirate,
source.commiamount,
source.chargebillid,
CASE fee_type
WHEN 3 THEN
"2"
WHEN "C" THEN
3
ELSE
4
END,
"新保单",
source.applicant,
source.applicantname,
source.insured,
source.insuredname,
source.endorseno,
source.policyno,
source.fee_target_id,
source.orgid,
NOW(),
source.operatedate,
source.after_tax_premium,
source.pay_time
FROM
(
SELECT
top.orgid,
top.operatedate,
top.applicantname,
top.applicant,
top.insured,
top.insuredname,
top.endorseno,
top.policyno,
top.discount,
tcl.chargebillid,
tcl.policyid,
tcl.premium,
tcl.after_tax_premium,
tcl.insurerid,
tcl.productid,
tcl.fee_target_id,
tcl.commirate,
tcl.commiamount,
tcl.fee_type,
tcl.pay_time
FROM
tbl_oper_policymana top
INNER JOIN tbl_chargebill tc ON top.id = tc.policyid
LEFT JOIN tbl_chargebill_list tcl ON tc.id = tcl.chargebillid
WHERE
top.isaudit = '12203'
AND top.chargebillid IN ('d696d806e3b74fc18fe163c6e4dd95fc')
) source

报错原因:CASE fee_type WHEN 3 THEN "2" WHEN "C" THEN 3 ELSE 4 END中3是数值型,C是字符型,无法相互转换,所以报错

改为

INSERT INTO tbl_receivable_list (
id,
POLICYID,
PRODUCTID,
FEETYPE,
INSURERID,
PREMIUM,
COMMIRATE,
COMMIAMOUNT,
CHARGEBILLID,
MARK,
REMARK,
applicant,
applicantname,
insured,
insuredname,
endorseno,
policyno,
agentid,
orgid,
createdate,
applicanttime,
afterTaxPremium,
pay_time
) SELECT
REPLACE (UUID(), "-", ""),
source.policyid,
source.productid,
source.fee_type,
source.insurerid,
source.premium,
source.commirate,
source.commiamount,
source.chargebillid,
CASE fee_type
WHEN "3" THEN
"2"
WHEN "C" THEN
3
ELSE
4
END,
"新保单",
source.applicant,
source.applicantname,
source.insured,
source.insuredname,
source.endorseno,
source.policyno,
source.fee_target_id,
source.orgid,
NOW(),
source.operatedate,
source.after_tax_premium,
source.pay_time
FROM
(
SELECT
top.orgid,
top.operatedate,
top.applicantname,
top.applicant,
top.insured,
top.insuredname,
top.endorseno,
top.policyno,
top.discount,
tcl.chargebillid,
tcl.policyid,
tcl.premium,
tcl.after_tax_premium,
tcl.insurerid,
tcl.productid,
tcl.fee_target_id,
tcl.commirate,
tcl.commiamount,
tcl.fee_type,
tcl.pay_time
FROM
tbl_oper_policymana top
INNER JOIN tbl_chargebill tc ON top.id = tc.policyid
LEFT JOIN tbl_chargebill_list tcl ON tc.id = tcl.chargebillid
WHERE
top.isaudit = '12203'
AND top.chargebillid IN ('d696d806e3b74fc18fe163c6e4dd95fc')
) source
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  mysql 异常
相关文章推荐