Oracle数据库中,使用case语句,遇到VARCHAR2与NVARCHAR2问题
问题:
在由sqlserver数据库迁移至Oracle数据库时,sql中遇到将VARCHAR2付给NVARCHAR2问题
原sql
CASE A .kindCode WHEN '2321034' THEN '02049' WHEN '2321035' THEN '11067' WHEN '2321022' THEN '11067' WHEN '2321039' THEN '02049' ELSE '2312' END AS CLASSESCODE,
修改后
CASE A .kindCode WHEN CAST('2321034' as nvarchar2(10)) THEN CAST('02049'as nvarchar2(10)) WHEN CAST('2321035' as nvarchar2(10)) THEN CAST('11067'as nvarchar2(10)) WHEN CAST('2321022' as nvarchar2(10)) THEN CAST('11067'as nvarchar2(10)) WHEN CAST('2321039' as nvarchar2(10)) THEN CAST('02049'as nvarchar2(10)) ELSE CAST('2312' as nvarchar2(10)) END AS CLASSESCODE,
详细问题:
https://blog.csdn.net/liuxiyangyang/article/details/8446692