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

原来的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



猜你喜欢

转载自blog.csdn.net/yuhui123999/article/details/79021800
今日推荐