oracle 添加 账号密码是什么格式sql语句根据条件分支执行–执行sql语句中的一部分(oracle)

 
预热  case when 用法:   www.2cto.com  

 (一):select caoracle账号se when 1=1 then 1 end from dual;

结果:

  www.2cto.com  

(二):

表结构:

 select (case when xm='gao' then '姓高的销售额' when xm= 'zhu' then '姓朱的销售额' end ),
sal from table3;

结果:

  www.2cto.com  

—————–预热结束———————-

 

表结构如下:

 

(一)使用case when 实现   www.2cto.com  

select * from table3 where
(select case when '&a'=1 then
  (select 1 from dual where xm = 'gao')
 when '&a'=2 then 
  (select 1 from dual where sal = '55.55')
 end from dual)=1;

 

执行输入参数  1  结果 :

输入参数 2   结果:   www.2cto.com  

(二) 使用decode 实现

select * from table3 where decode('&a',1,decode(xm,'gao',1),2,decode(sal,'55.55',1)) = 1;

 

结果同上

此条目发表在oracle metalink账号分类目录,贴了标签。将固定链接加入收藏夹。