Oracle常用的函数:
sysdate
systimestamp
to_char
to_date:
select to_date('06-5月-1957','DD-Mon-YY') from dual;
nvl:
select nvl(sal,'空') from emp;
decode:
decode(条件,值1,翻译值1,值2,翻译值2,...值n,翻译值n,缺省值)
该函数的含义如下:
IF 条件=值1 THEN
RETURN(翻译值1)
ELSIF 条件=值2 THEN
RETURN(翻译值2)
......
ELSIF 条件=值n THEN
RETURN(翻译值n)
ELSE
RETURN(缺省值)
END IF
String sql =
"select product_name,sum(decode(bill_month,'"+chargePeriod+"',charge))/100 as cur_charge,
sum(decode(bill_month,'"+lastPeriod+"',charge))/100 as last_charge, "
+
" sum(decode(bill_month,'"+chargePeriod+"',bill_time_len))/60 as cur_time,
sum(decode(bill_month,'"+lastPeriod+"',bill_time_len))/60 as last_time "
+
" from tl_acc_report "
+
" group by product_name ";
SELECT sid,serial#,username,
DECODE(command
,0,’None’
,2,’Insert’
,3,’Select’
,6,’Update’
,7,’Delete’
,8,’Drop
,’Other’) cmd from des