要用case代替, 具体用法请看联机帮助

解决方案 »

  1.   

    SELECT '总计' AS 总计,0  AS GSZY,0 AS LSG,0 AS ZZRY,0 AS FPZE,0 AS JHWJE,
    (SUM( DECODE( SUBSTR(HPBH,1,6),:TYear01 ,NVL(XJ,0),0))
    +SUM( DECODE( SUBSTR(HPBH,1,6),:TYear02 ,NVL(XJ,0),0))
    +SUM( DECODE( SUBSTR(HPBH,1,6),:TYear03 ,NVL(XJ,0),0))) AS "01"
    FROM TABLE_BGYPLYB
    WHERE HPBH Like :TYear
      

  2.   

    decode函数只用于ORACLE数据库SQL中!
      

  3.   

    decode(mytable.columnname,'0','这是零','1','这是一','剩下的都是除了零一的数')
    明白了吗?
    但是decode只是Oracle的函数
      

  4.   

    呵呵
    if '0',then“这是零”
    else if ‘1’then"这是一”
    else
    '剩下的都是除了零一的数'
    end if
      

  5.   

    来一段>:)To evaluate this expression, Oracle compares expr to each search value one by one. If expr is equal to a search, Oracle returns the corresponding result. If no match is found, Oracle returns default, or, if default is omitted, returns null. If expr and search contain character data, Oracle compares them using nonpadded comparison semantics. For information on these semantics, see the section "Datatype Comparison Rules". 
    The search, result, and default values can be derived from expressions. Oracle evaluates each search value only before comparing it to expr, rather than evaluating all search values before comparing any of them with expr. Consequently, Oracle never evaluates a search if a previous search is equal to expr. 
    Oracle automatically converts expr and each search value to the datatype of the first search value before comparing. Oracle automatically converts the return value to the same datatype as the first result. If the first result has the datatype CHAR or if the first result is null, then Oracle converts the return value to the datatype VARCHAR2. For information on datatype conversion, see "Data Conversion". 
    In a DECODE expression, Oracle considers two nulls to be equivalent. If expr is null, Oracle returns the result of the first search that is also null. 
    The maximum number of components in the DECODE expression, including expr, searches, results, and default is 255. 
    Example
    This expression decodes the value DEPTNO. If DEPTNO is 10, the expression evaluates to 'ACCOUNTING'; if DEPTNO is 20, it evaluates to 'RESEARCH'; etc. If DEPTNO is not 10, 20, 30, or 40, the expression returns 'NONE'. DECODE (deptno,10, 'ACCOUNTING', 
                   20, 'RESEARCH', 
                   30, 'SALES', 
                   40, 'OPERATION',                     
                        'NONE')