执行 sum(decode)sql语句时,提示ORA-0092:数据类型不一致,应为NUMBER,但却获得DATE,该如何处理?
SELECTt.ORDER_NO,sum(decode(t.async_flag,'保费试算成功',to_date(to_char(t.create_time,'yyyy...
SELECT t.ORDER_NO,
sum(decode(t.async_flag,
'保费试算成功',
to_date(to_char(t.create_time, 'yyyy-mm-dd hh24:mi:ss'),
'yyyy-mm-dd hh24:mi:ss'))) "投保规则-保费试算成功",
sum(decode(t.async_flag,
'投保规则校验成功',
to_date(to_char(t.create_time, 'yyyy-mm-dd hh24:mi:ss'),
'yyyy-mm-dd hh24:mi:ss'))) "投保规则校验成功",
sum(decode(t.async_flag,
'影像件上传FTP成功',
to_date(to_char(t.create_time, 'yyyy-mm-dd hh24:mi:ss'),
'yyyy-mm-dd hh24:mi:ss'))) "影像件上传FTP成功"
FROM T_INTERFACE_LOGS t
where t.order_no like '8%'
GROUP BY t.ORDER_NO
ORDER BY t.ORDER_NO asc 展开
sum(decode(t.async_flag,
'保费试算成功',
to_date(to_char(t.create_time, 'yyyy-mm-dd hh24:mi:ss'),
'yyyy-mm-dd hh24:mi:ss'))) "投保规则-保费试算成功",
sum(decode(t.async_flag,
'投保规则校验成功',
to_date(to_char(t.create_time, 'yyyy-mm-dd hh24:mi:ss'),
'yyyy-mm-dd hh24:mi:ss'))) "投保规则校验成功",
sum(decode(t.async_flag,
'影像件上传FTP成功',
to_date(to_char(t.create_time, 'yyyy-mm-dd hh24:mi:ss'),
'yyyy-mm-dd hh24:mi:ss'))) "影像件上传FTP成功"
FROM T_INTERFACE_LOGS t
where t.order_no like '8%'
GROUP BY t.ORDER_NO
ORDER BY t.ORDER_NO asc 展开
1个回答
展开全部
sum()函数数据类型必须为数值型,若要把字符串相连可以使用vm_contact()函数
更多追问追答
追问
如何使用呢?对于时间类型能否使用?
追答
SELECT t.ORDER_NO,
vm_contact(decode(t.async_flag,
'保费试算成功',
to_date(to_char(t.create_time, 'yyyy-mm-dd hh24:mi:ss'),
'yyyy-mm-dd hh24:mi:ss'))) "投保规则保费试算成功",
vm_contact(decode(t.async_flag,
'投保规则校验成功',
to_date(to_char(t.create_time, 'yyyy-mm-dd hh24:mi:ss'),
'yyyy-mm-dd hh24:mi:ss'))) "投保规则校验成功",
vm_contact(decode(t.async_flag,
'影像件上传FTP成功',
to_date(to_char(t.create_time, 'yyyy-mm-dd hh24:mi:ss'),
'yyyy-mm-dd hh24:mi:ss'))) "影像件上传FTP成功"
FROM T_INTERFACE_LOGS t
where t.order_no like '8%'
GROUP BY t.ORDER_NO
ORDER BY t.ORDER_NO asc
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询