oracle decode函数的用法
发表于:2026-11-02 作者:千家信息网编辑
千家信息网最后更新 2026年11月02日,oracle decode函数,不管查询的结果是否满足'PRIMARY',参数中的select语句还是会执行的,通过查看执行计划就知道set autotrace traceonlyselect dec
千家信息网最后更新 2026年11月02日oracle decode函数的用法
oracle decode函数,不管查询的结果是否满足'PRIMARY',参数中的select语句还是会执行的,通过查看执行计划就知道
set autotrace traceonly
select decode(database_role ,'PRIMARY', (selecttrunc((size_MB-free_MB)*100/maxsize_MB) "retvalue"from (selecttablespace_name,case when sum(decode(autoextensible,'YES',1,0))>0 then 'YES'else 'NO' end ext,trunc(sum(bytes)/1024/1024) SIZE_MB,trunc(sum(case when autoextensible='YES' then maxbytes else bytesend)/1024/1024) MAXSIZE_MBfrom dba_data_filesgroup by tablespace_name) t1,(select tablespace_name,trunc(sum(bytes)/1024/1024) FREE_MBfrom dba_free_spacegroup by tablespace_name) t2,(select tablespace_namefrom dba_tablespaceswhere contents='PERMANENT') t3where t1.tablespace_name=t2.tablespace_name and t3.tablespace_name=t1.tablespace_name and t3.tablespace_name='SYSTEM'),0) as retvalue from v$database;decode函数等价于cash when语句,只不过当条件比较多时,decode函数书写起来比较简洁一点而已
select case when database_role = 'PRIMARY' then (select tname from tab where rownum=1) else '0' end as retvalue from v$database;
函数
语句
简洁
参数
只不过
条件
等价
结果
还是
查询
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
互联网和科技技术
科技与互联网
涨乐互联网科技
深圳互联网科技公司
深圳互联网络科技有限公司
为想互联网科技
致聘互联网科技
北京禾田雨橡互联网科技
互联网科技大会
移动互联网科技股
南平创想时代互联网科技有限公司
语蝶互联网科技有限公司
花神(南京)互联网科技有限公司
互联网科技产业特征
健康食品互联网创新科技园项目
爱医互联网络科技
山东子淼互联网科技有限公司
华人运通互联网科技公司
上海旺乐尼互联网科技有限公司
宁波允成互联网科技有限公司
有格互联网科技
科技互联网龙头
宜安科技 互联网金融
华中科技大学互联网
科技与互联网的利与弊
欧洲十大科技互联网公司
常德市电业局互联网科技部
互联网媒体平台算高科技产业
银川新华互联网科技学校招聘
科技发展第三阶段互联网时代