use case or decode:
select decode(sign(a-b),1,'CUL1','CUL2') from table

解决方案 »

  1.   

    SET SERVEROUTPUT ON;
    declare
      begin
      for t in(select a,b from table) loop
          if t.a>t.b then
             dbms_output.put_line('CUL1');
          else
             dbms_output.put_line('CUL2');
          end if;
      end loop;
      end;
    /
      

  2.   

    oracle会把字符型稳式转为数字型
      

  3.   

    ??????SQL> select decode(sign('a'-'b'),
      2                  1,'大于',
      3                  '小于等于'
      4               )
      5  from dual;
    select decode(sign('a'-'b'),
                       *
    ERROR at line 1:
    ORA-01722: invalid number
      

  4.   

    西域浪子的已经提示了用case或者decode.docoded的方法浪子写了,我把case的写出来:select (case where a > b then 'CUL1' else 'CUL2') as display from table