对于ASCII以及CHR函数的用法,Oracle给出的解释是: ASCII(x)gets the ASCII value of the character X, CHR() and ASCII() have the opposite effect. 即:ASCII函数是用于将字符转换成其相应的ASCII码,而CHR函数作用则恰好相反: 下面我来看一些简单的例子: SELECT ASCII('x'), ASCII('y'),ASCII('z') from dual; 语句执行的结果为 120,12…
decode函数主要作用:将查询结果翻译成其他值(即以其他形式变现出来) 使用方法: SELECT DECODE(colunm_name,值1,翻译值1,值2,翻译值2……值n,翻译值n,缺省值) FROM tablename; 解释: if (条件==值1) then return(翻译值1)elsif (条件==值2) then return(翻译值2) ....... elsif (条件==值n) then return(翻译值n) else return(缺省值) end if 注:其中…
组函数:avg sum max min count group by having group by 增强:rollup cube grouping grouping set 一.分组函数 1.常用分组函数 AVG([DISTINCT|ALL]n) -- 求平均值,忽略空值 COUNT({*|[DISTINCT|ALL]expr}) -- 统计个数,其中expr用来判定非空值(使用*计算所有选定行,包括重复行和带有空值的行) MAX([DISTINCT|AL…