use decode and sign can do this.
---------------------
or use case:
case when .... then ... else ...

解决方案 »

  1.   

    select no,f1,f2,decode(sign(f1-f2),1,true,false)f3 from table
      

  2.   

    谁能否 使用case when...then ..else 语句写出如上的sql语句
    谢了 再加分!
      

  3.   

    case when...then ..else 在9i中才可以用
    8i只能select no,f1,f2,decode(sign(f1-f2),1,true,false)f3 from table
      

  4.   

    8.1.7中也可以使用case when...then ..else
      

  5.   

    http://expert.csdn.net/Expert/topic/1507/1507392.xml?temp=.7941553
      

  6.   

    select no,f1,f2,case when f1>f2 then 'true' else 'false' end f3 from table1
      

  7.   

    select no,f1,f2,decode(sign(f1-f2),1,true,-1,false,null) f3 from table
      

  8.   

    如果是ora8i使用decode语句,如果是9i,使用case语句,具体用法,你可以search一下贴子,有讲的。
      

  9.   

    Oracle8i也可以使用case
    至少存储过程里可以使用动态SQL语句执行带有case有语句。select no,f1,f2,case when f1>f2 then true else false end  f3 from table;
      

  10.   

    在oracle中可以用decode
    在sqlserver中可以iif
      

  11.   

    SELECT ename, 
    (CASE deptno
      WHEN 10 THEN 'ACCOUNTING'
      WHEN 20 THEN 'RESEARCH'
      WHEN 30 THEN 'SALES'
      WHEN 40 THEN 'OPERATIONS'
      ELSE 'Unassigned'
      END ) as Department
    FROM emp;
    8i中可以用decode
      

  12.   

    select no,f1,f2,decode(sign(f1-f2),1,'true','false')f3 from table