一、数学函数
O:select abs(-1) value from dual
O:select ceil(-1.001) value from dual
O:select floor(-1.001) value from dual
O:select trunc(-1.002) value from dual
O:select round(1.23456,4) value from dual 1.2346
O:select Exp(1) value from dual 2.71828182
O:select ln(2.7182818284590451) value from dual; 1
O:select log(10,10) value from dual; 1
O:select power(4,2) value from dual 16
O:select SQRT(4) value from dual 2
O:select power(3,4) value from dual 81
O:select sys.dbms_random.value(0,1) value from dual;
O:select sign(-8) value from dual -1
O:select acos(-1) PI from dual; select exp(1) e from dual;
16.Asin,Acos,Atan,Atan2 返回弧度
17.弧度角度互换(SQLServer,Oracle未知)
二、数值间比较
S:select max(value) value from
(select 1 value
union
select -2 value
union
select 4 value
union
select 3 value)a
(select 1 value
union
select -2 value
union
select 4 value
union
select 3 value)a
O:select F1,nvl(F2,10) value from Tbl
O:select ascii(''a'') value from dual
O:select chr(97) value from dual
O:select CONCAT(''11'',''22'')||33 value from dual
O:select INSTR(''sdsq'',''s'',2) value from dual
O:oracle没发现,但是instr可以通过第四个参数控制出现次数
select INSTR(''sdsfasdqe'',''sd'',1,2) value from dual 返回6
O:select substr(''abcd'',2,2) value from dual
O:SELECT Replace(''abcdef'', ''bcd'', ''ijklmn'') value from dual
O:select Translate(''fasdbfasegas'',''fa'',''我'' ) value from dual
O:length
29.单词首字母大写
O:select INITCAP(''abcd dsaf df'') value from dual
O:select LPAD(''abcd'',14) value from dual
O:select RPAD(''abcd'',14) value from dual
32.删除空格
O:ltrim,rtrim,trim
O:没发现
34.发音相似性比较(这两个单词返回值一样,发音相同)
O:SELECT SOUNDEX (''Smith''), SOUNDEX (''Smythe'') from dual
SQLServer中用SELECT DIFFERENCE(''Smithers'', ''Smythers'') 比较soundex的差
返回0-4,4为同音,1最高日期函数
O:select sysdate value from dual
37.求日期
O:select trunc(sysdate) value from dual
select to_char(sysdate,''yyyy-mm-dd'') value from dual
O:select to_char(sysdate,''hh24:mm:ss'') value from dual
O:to_char函数 第二个参数决定
year yy, yyyy
quarter qq, q (季度)
month mm, m (m O无效)
dayofyear dy, y (O表星期)
day dd, d (d O无效)
week wk, ww (wk O无效)
weekday dw (O不清楚)
Hour hh,hh12,hh24 (hh12,hh24 S无效)
minute mi, n (n O无效)
second ss, s (s O无效)
millisecond ms (O无效)
----------------------------------------------
S:未知
O:select LAST_DAY(sysdate) value from dual
O:SELECT Next_day(sysdate,7) vaule FROM DUAL;
S:可以直接转或者select cast(''2004-09-08''as datetime) value
O:SELECT To_date(''2004-01-05 22:09:38'',''yyyy-mm-dd hh24-mi-ss'') vaule FROM DUAL;
S:select datediff(ss,getdate(),getdate()+12.3) value
O:直接用两个日期相减(比如d1-d2=12.3)
SELECT (d1-d2)*24*60*60 vaule FROM DUAL;
O:SELECT sysdate+8/60/24 vaule FROM DUAL;
O:SELECT New_time(sysdate,''ydt'',''gmt'' ) vaule FROM DUAL;
AST ADT 大西洋标准时间
BST BDT 白令海标准时间
CST CDT 中部标准时间
EST EDT 东部标准时间
GMT 格林尼治标准时间
HST HDT 阿拉斯加?夏威夷标准时间
MST MDT 山区标准时间
NST 纽芬兰标准时间
PST PDT 太平洋标准时间
YST YDT YUKON标准时间