SELECT job, sal,
           DECODE(job, 'ANALYST', SAL*1.1,
                       'CLERK',   SAL*1.15,
                       'MANAGER', SAL*1.20,
                                  SAL)
                  REVISED_SALARY
    FROM   emp;

解决方案 »

  1.   

    非常感谢,
     我的意思是table_column的值为不确定的数值,只要大于0 就为1,否则为0
      

  2.   

    sorry, should be:
    decode(sign(table_column),1,1,0)
      

  3.   

    一样啊!?
    SELECT "ZZJG_RY"."DWBM",   
             CASE WHEN to_number( substr( "ZGXX"."WHCD",1,1) )>=7 THEN '6' ELSE substr( "ZGXX"."WHCD",1,1) END  
        FROM "ZGXX",   
             "ZZJG_RY"
      

  4.   

    sign(x)返回数值的符号,
    when x>0 then sign(x) = 1
    when x=0 then sign(x) = 0
    when x<0 then sign(x) = -1
      

  5.   

    用Decode()函数可以解决搂主的问题,但在pl/sql中case的如下用法为何不对?
    case  con
      when 'A' then  a1;return 1;
      when 'B' then  a2;return 2;
      when 'C' then  a3;return 3;
    end  as aa;
      

  6.   

    select (case when (column>0) then (1) else (0) end) from table_name
      

  7.   

    select (case when (column>0) then (1) else (0) end) from table_name
    加几个括号就行了.
      

  8.   

    eg:select  case when 1> 0 then 'The value is 1' else 'The value is 0' end   from dual select  decode(1,1,'true','false')  from dual 
      

  9.   

    与我联系吧,我的邮箱为[email protected]