轉自:http://hi.baidu.com/tidehc/blog/item/3fd6b9a14766268b4610642a.html
*******************************************************************************<br />* SQL Group Functions (num can be a column or expression) *<br /> *(null values are ignored, default between distinct and all is all) *<br /> *******************************************************************************<br /> AVG([distinct or all] num) -- average value<br /> COUNT(distinct or all] num) -- number of values<br /> MAX([distinct or all] num) -- maximum value<br /> MAX([distinct or all] num) -- minimum value<br /> STDDEV([distinct or all] num) -- standard deviation<br /> SUM([distinct or all] num) -- sum of values<br /> VARIANCE([distinct or all] num) -- variance of values<br /> <br /> *******************************************************************************<br /> * Miscellaneaous Functions : *<br /> *******************************************************************************<br /> DECODE(expr, srch1, return1 [,srch2, return2...], default]<br /> -- if no search matches the expression then the default is returned,<br /> -- otherwise, the first search that matches will cause<br /> -- the corresponding return value to be returned<br /> DUMP(column_name [,fmt [,start_pos [, length]]])<br /> -- returns an internal oracle format, used for getting info about a column<br /> -- format options : 8 = octal, 10 = decimel, 16 = hex, 17 = characters<br /> -- return type codes : 1 = varchar2, 2 = number, 8 = long, 12 = date,<br /> -- 23 = raw, 24 = long raw, 69 = rowid, 96 = char, 106 = mlslabel<br /> GREATEST(expr [,expr2 [, expr3...]]<br /> -- returns the largest value of all expressions<br /> LEAST(expr [,expr2 [, expr3...]]<br /> -- returns the smallest value of all expressions<br /> NVL(expr1 ,expr2<br /> -- if expr1 is not null, it is returned, otherwise expr2 is returned<br /> SQLCODE<br /> -- returns sql error code of last error. Can not be used directly in query,<br /> -- value must be set to local variable first<br /> SQLERRM<br /> -- returns sql error message of last error. Can not be used directly in query,<br /> -- value must be set to local variable first<br /> UID<br /> -- returns the user id of the user you are logged on as<br /> -- useful in selecting information from low level sys tables<br /> USER<br /> -- returns the user name of the user you are logged on as<br /> USERENV('option')<br /> -- returns information about the user you are logged on as<br /> -- options : ENTRYID, SESSIONID, TERMINAL, LANGUAGE, LABEL, OSDBA<br /> -- (all options not available in all Oracle versions)<br /> VSIZE(expr)<br /> -- returns the number of bytes used by the expression<br /> -- useful in selecting information about table space requirements<br /> <br /> *******************************************************************************<br /> * SQL Date Functions (dt represents oracle date and time) *<br /> * (functions return an oracle date unless otherwise specified) *<br /> *******************************************************************************<br /> ADD_MONTHS(dt, num) -- adds num months to dt (num can be negative)<br /> LAST_DAY(dt) -- last day of month in month containing dt<br /> MONTHS_BETWEEN(dt1, dt2) -- returns fractional value of months between dt1, dt2<br /> NEW_TIME(dt, tz1, tz2) -- dt = date in time zone 1, returns date in time zone 2<br /> NEXT_DAY(dt, str) -- date of first (str) after dt (str = 'Monday', etc..)<br /> SYSDATE -- present system date<br /> ROUND(dt [,fmt] -- rounds dt as specified by format fmt<br /> TRUNC(dt [,fmt] -- truncates dt as specified by format fmt<br /> <br /> *******************************************************************************<br /> * Number Functions : *<br /> *******************************************************************************<br /> ABS(num) -- absolute value of num<br /> CEIL(num) -- smallest integer > or = num<br /> COS(num) -- cosine(num), num in radians<br /> COSH(num) -- hyperbolic cosine(num)<br /> EXP(num) -- e raised to the num power<br /> FLOOR(num) -- largest integer < or = num<br /> LN(num) -- natural logarithm of num<br /> LOG(num2, num1) -- logarithm base num2 of num1<br /> MOD(num2, num1) -- remainder of num2 / num1<br /> POWER(num2, num1) -- num2 raised to the num1 power<br /> ROUND(num1 [,num2] -- num1 rounded to num2 decimel places (default 0)<br /> SIGN(num) -- sign of num * 1, 0 if num = 0<br /> SIN(num) -- sin(num), num in radians<br /> SINH(num) -- hyperbolic sine(num)<br /> SQRT(num) -- square root of num<br /> TAN(num) -- tangent(num), num in radians<br /> TANH(num) -- hyperbolic tangent(num)<br /> TRUNC(num1 [,num2] -- truncate num1 to num2 decimel places (default 0)<br /> <br /> *******************************************************************************<br /> * String Functions, String Result : *<br /> *******************************************************************************<br /> (num) -- ASCII character for num<br /> CHR(num) -- ASCII character for num<br /> CONCAT(str1, str2) -- str1 concatenated with str2 (same as str1||str2)<br /> INITCAP(str) -- capitalize first letter of each word in str<br /> LOWER(str) -- str with all letters in lowercase<br /> LPAD(str1, num [,str2]) -- left pad str1 to length num with str2 (default spaces)<br /> LTRIM(str [,set]) -- remove set from left side of str (default spaces)<br /> NLS_INITCAP(str [,nls_val]) -- same as initcap for different languages<br /> NLS_LOWER(str [,nls_val]) -- same as lower for different languages<br /> REPLACE(str1, str2 [,str3]) -- replaces str2 with str3 in str1<br /> -- deletes str2 from str1 if str3 is omitted<br /> RPAD(str1, num [,str2]) -- right pad str1 to length num with str2 (default spaces)<br /> RTRIM(str [,set]) -- remove set from right side of str (default spaces)<br /> SOUNDEX(str) -- phonetic representation of str<br /> SUBSTR(str, num2 [,num1]) -- substring of str, starting with num2,<br /> -- num1 characters (to end of str if num1 is omitted)<br /> SUBSTRB(str, num2 [,num1]) -- same as substr but num1, num2 expressed in bytes<br /> TRANSLATE(str, set1, set2) -- replaces set1 in str with set2<br /> -- if set2 is longer than set1, it will be truncated<br /> UPPER(str) -- str with all letters in uppercase<br /> <br /> *******************************************************************************<br /> * String Functions, Numeric Result : *<br /> *******************************************************************************<br /> <br /> ASCII(str) -- ASCII value of str<br /> INSTR(str1, str2 [,num1 [,num2]]) -- position of num2th occurrence of<br /> -- str2 in str1, starting at num1<br /> -- (num1, num2 default to 1)<br /> INSTRB(str1, str2 [,num1 [num2]]) -- same as instr, byte values for num1, num2<br /> LENGTH(str) -- number of characters in str<br /> LENGTHB(str) -- number of bytes in str<br /> NLSSORT(str [,nls_val]) <br />