当前位置:网站首页>SQL中函数 decode()与 replace()的用法
SQL中函数 decode()与 replace()的用法
2022-04-23 18:34:00 【大胖某人】
Oracle将查询出的结果用别的值显示,例如:查出某个字段值为abc,可以换成123显示
语法:
replace一般使用
replace ( status , 'x' ,'男' )
即:将status字段中所有出现的x替换为男。
replace嵌套使用
replace(replace(replace(t.STATUS,'0','正常'),'1','暂停'),'2','停止')
即:将status字段中所有出现的0替换为正常,1替换为暂停,2替换为停止。
decode用法
decode(条件,值1,返回值1,值2,返回值2,…值n,返回值n)
decode(status,'0','正常','1','暂停','2','停止')
即:将status字段中所有出现的0替换为正常,1替换为暂停,2替换为停止。
版权声明
本文为[大胖某人]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_44369870/article/details/124345300
边栏推荐
- Creation and use of QT dynamic link library
- Solution to Chinese garbled code after reg file is imported into the registry
- CANopen STM32 transplantation
- CISSP certified daily knowledge points (April 14, 2022)
- Cutting permission of logrotate file
- 【数学建模】—— 层次分析法(AHP)
- listener.log
- Feign requests the log to be printed uniformly
- 纠结
- 数据库上机实验四(数据完整性与存储过程)
猜你喜欢
kettle庖丁解牛第17篇之文本文件输出
硬核解析Promise對象(這七個必會的常用API和七個關鍵問題你都了解嗎?)
With the use of qchart, the final UI interface can be realized. The control of qweight can be added and promoted to a user-defined class. Only the class needs to be promoted to realize the coordinate
Cygwin64 right click to add menu, and open cygwin64 here
Iptables - L executes slowly
Query the logistics update quantity according to the express order number
Use Chenxi bookkeeping book to analyze the balance of revenue and expenditure of each account in a certain period of time
WIN1 remote "this may be due to credssp encryption Oracle correction" solution
Robocode tutorial 7 - Radar locking
纠结
随机推荐
Robocode tutorial 8 - advanced robot
Use Chenxi bookkeeping book to analyze the balance of revenue and expenditure of each account in a certain period of time
深度学习经典网络解析目标检测篇(一):R-CNN
Spark performance optimization guide
Notepad + + replaces tabs with spaces
昇腾 AI 开发者创享日全国巡回首站在西安成功举行
Serialization scheme of serde - trust
Configure iptables
Hard core parsing promise object (do you know these seven common APIs and seven key questions?)
Imx6 debugging LVDS screen technical notes
Permission management with binary
JD-FreeFuck 京東薅羊毛控制面板 後臺命令執行漏洞
【ACM】70. climb stairs
Introduction to QT programming
Resolves the interface method that allows annotation requests to be written in postman
ctfshow-web362(SSTI)
QT notes on qmap container freeing memory
Daily network security certification test questions (April 13, 2022)
14 py games source code share the second bullet
SQL database syntax learning notes