二则 ORA-01722: invalid number错误的处理,substr to_char之间的区别。连接符号错误 + ||

Select to_char(loginDate,'yyyy') as sYear, Count(1) as iCount From l_log where operation='登录'  
and InitFlag=1 Group By to_char(loginDate,'yyyy')
> ORA-01722: invalid number

sql语句改为:
Select substr(loginDate,1,4) as sYear, Count(1) as iCount From l_log where operation='登录'
  and InitFlag=1 Group By substr(loginDate,1,4) 

问题解决


还有一种是字符连接符号错误导致,oracle连接字符要用“||”不能用“+”

and ('','' + ListUser + '','' like %s and iStat <> -1)

改为

and ('','' || ListUser || '','' like %s and iStat <> -1)

问题解决

 

posted @ 2022-10-04 00:15  IT情深  阅读(34)  评论(0编辑  收藏  举报