当前位置: 代码迷 >> 综合 >> case when then 使用报字符集不匹配错误(oracle)
  详细解决方案

case when then 使用报字符集不匹配错误(oracle)

热度:64   发布时间:2024-01-28 03:49:06.0

select case when t.name = 'chang' then 'hong' else t.name end from student t

then后使用了字符串‘hong’和t.name字段,这时候会报字符集不匹配。

解决方法字段加to_char,即

select case when t.name = 'chang' then 'hong' else to_char(t.name) end from student t