sql語句 字元函數,數字函數

來源:互聯網
上載者:User

標籤:數字   截斷   power   asc   pow   round   ace   開始   cat   

 1 -- 字元函數 2  3 -- ASCII(X) 返回字元x 的 ASCII碼 4 select ASCII(‘a‘) FROM DUAL;    -- 返回97 5  6 -- CONCAT(X,Y) 連接字串x和y 7 select  concat(‘123‘,‘ 456‘) from dual;  -- 返回 123 456 8  9 -- INSTR(X,str [,start][,n) :在x中尋找str,可以指定從start開始,也可以指定從第n次開始10 select instr(‘hahdf‘,‘f‘) from dual;  -- 返回str的位置11 12 -- length(x) 返回x的長度13 select length(‘d545‘) from dual;  --返回414 15 -- lower(x)   將x轉變為小寫16 select lower(‘ABCD‘) from dual; -- 返回abcd17 18 -- upper(x)  將x轉變為大寫19 select upper(‘abcde‘) from dual;  -- 返回ABCDE20 21 -- ltrim(x,[str]) 把x的左邊截去str 字串,預設截去空格22 SELECT ltrim(‘===HELLO===‘, ‘=‘) FROM DUAL  -- 返回  HELLO===23 24 25 -- rtrim(x,[str]) 把x的右邊截去str 字串,預設截去空格26 SELECT rtrim(‘===HELLO===‘, ‘=‘) FROM DUAL  -- 返回  ===HELLO27 28 -- trim([str from] x) 把x的兩邊截去str 字串,預設截去空格29 SELECT TRIM(‘=‘ FROM ‘===HELLO===‘) FROM DUAL; -- 返回  HELLO30 31 -- replace(x,old,new) 在x中尋找old, 並替換為new32 select replace(‘avaddfs‘,‘d‘,‘e‘) from dual; -- 返回結果avaeefs33 34 -- substr(x,start,[,length]) 返回x的字串,從start處開始,35 --截取length個字元,預設length,預設到結尾36 select substr(‘abcdefg‘,2,4) from dual;--返回:bcde37 38 39 -- 數學函數40 -- abs(x) x絕對值41 select abs(-5) from dual; -- 返回  542 43 -- acos(x) x的反餘弦44 select acos(1) from dual; -- 返回045 46 -- cos(x) 餘弦47 select cos(1) from dual; -- 返回0.5403023058681448 49 -- ceil(x) 大於或等於x的最小值50 select ceil(5.2) from dual; -- 返回651 52 --floor(x) 小於或等於x的最大值53 select floor(5.2) from dual; -- 返回554 55 56 --  log(x,y) x為低y的對數57 select log(2,2) from dual; -- 返回158 59 --  mod(x,y) x除以y的餘數60 select mod(2,3) from dual; -- 返回261 62 --  power(x,y) x的y次冪63 select power(2,3) from dual; -- 返回864 65 -- round(x[,y])  x在第y位四捨五入 66 --y預設為0,如果y為負數,小數點右邊截補0 ,如果y為正數,小數點左邊截 ,67 select round(2.2160,2) from dual; -- 返回2.2268 69 -- sqrt(x)  x的平方根70 select sqrt(4) from dual; -- 返回271 72 -- trunc(x[,y]) x在第y位截斷; 不四捨五入。73 --y預設為0,如果y為負數,小數點右邊截補0 ,如果y為正數,小數點左邊截 ,74 select trunc(334.255,-1) from dual; -- 返回330

 

sql語句 字元函數,數字函數

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.