我想实现根据字符串比较的结果输出不同的内容,
比如:如果'abce'>'abcd' 输出'>',小于则输出'<',否则输出'=',怎么实现?

解决方案 »

  1.   

    安装了ORACLE 9i后怎么找不到关于SQL 的帮助啊?
      

  2.   

    create or replace function compstr(str1 in varchar2,str2 in varchar2)
    return number
    is
    begin
    if str1>str2 then
        return 1;
    end if;
    if str1<str2 then
       return -1;
    end if;
    if str1=str2 then
        return 0;
    end if;
    end compstr;SQL> select decode(compstr('abc','acd'),1,'>',0,'=',-1,'<') from dual;D
    -
    <SQL> 
      

  3.   

    9i :select case when 'a' > 'b' then '>' when 'a' < 'b' then '<' else '=' end 
    from dual
      

  4.   

    没想到在ORACLE中也能这样写,谢谢各位!