Oracle 中的 decode
????????? decode ??????????????????????????? ????????????????????????? decode ???????? ?????????????????????????????????? ????????????????? LPAD?SIGN ??????????????????
发布日期:2025-04-29 13:04:37
浏览次数:16
分类:精选文章
本文共 1685 字,大约阅读时间需要 5 分钟。
Oracle SQL decode ??????????
decode ???????
? Oracle SQL ??decode ??????????????????????????????
decode( string , number , string1 , string2 , ... , stringN )
???string ???????????? string1?string2 ????????????????????????decode ?????????????????????? NULL ????????
IF-THEN-ELSE ????
???????decode ???? IF-THEN-ELSE ???????????????????????????????????
IF condition THEN RETURN ( value_1 )ELSIF condition_2 THEN RETURN ( value_2 )...ELSIF condition_n THEN RETURN ( value_n )ELSE RETURN ( default_value )END IF
???
IF "select column from table" = 'X' THEN RETURN (1)ELSIF "select column from table" = 'Y' THEN RETURN (2)ELSE RETURN (0)END IF
????????????????????????????
LPAD ?????
?? decode ???LPAD??????????????????????????????????????????????????
LPAD( decode("direction", 1, 'N', 'S'), 14, '0' ) ?? direction ????? 'N'?? decode ????? 1???? LPAD ?????????? 14 ??????? '0000000000000001'?
??????
?? 1????????
select LPAD(decode(count( directory ), 0, 1, max( to_number( directory ) + 1 )), 14, '0') from tetdmis
?????????????? decode ??????????LPAD ???????? 14 ????????? '0'?
?? 2?????
select decode( "subject_name", 'A', 1, 'B', 2, 'C', 3 ) from table_subject
?????? subject_name ?????????? 1?2 ? 3?????????????????
?? 3??????????
IF "column" = 'X' THEN RETURN (1)ELSE RETURN (0)END IF
???decode ??????????? SIGN ?????
sign( decode("column1", 10, "column2", 20) - 1 ) ?????????????????????????????????
??????
????????????????????
???????Oracle SQL decode ?????????????????????????????????
发表评论
最新留言
路过按个爪印,很不错,赞一个!
[***.219.124.196]2026年06月16日 22时53分37秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
quiver绘制python语言
2023-03-02
pip下载缓慢
2023-03-02
PIP使用SSH从BitBucket安装自定义软件包,无需输入SSH密码
2023-03-02
pip在安装模块时提示Read timed out
2023-03-02
pip更换源
2023-03-02
SpringBoot之Banner源码深度分解
2023-03-02
Pix2Pix如何工作?
2023-03-02
QuickBI助你成为分析师——搞定数据源
2023-03-02
pkl来存储python字典
2023-03-02
quick sort | 快速排序 C++ 实现
2023-03-02
pkpmbs 建设工程质量监督系统 文件上传漏洞复现
2023-03-02
queue队列、deque双端队列和priority_queue优先队列
2023-03-02
PKUSC2018游记
2023-03-02
PK项目测试,做产品测试有这4大优势!
2023-03-02
PL SQLDEVELOPMENT导出数据库脚本
2023-03-02
Queue
2023-03-02