一 语法
decode(column_name,value1,result1,
...,defaultvalue)
二 代码
SQL>select username,decode(username,'aaa','jsj','bbb','scbm','other')as department2from users;USERNAME DEPAR-------------------------aaa jsjbbb scbmcccc otheraaa jsj
本文介绍了一个SQL中的DECODE函数使用示例,通过不同的输入返回对应的部门名称。示例展示了如何根据用户名返回预定义的部门名称。
一 语法
SQL>select username,decode(username,'aaa','jsj','bbb','scbm','other')as department2from users;USERNAME DEPAR-------------------------aaa jsjbbb scbmcccc otheraaa jsj
被折叠的 条评论
为什么被折叠?