Oracle常用的函數(shù):
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,缺省值)
該函數(shù)的含義如下:
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