Oracle文本函數(shù)簡介
Oracle文本函數(shù)使我們常用的函數(shù),下面就為您介紹幾種Oracle文本函數(shù)的用法,供您參考學(xué)習(xí),希望可以讓您對Oracle文本函數(shù)有更深的認識。
(1)UPPER、LOWER和INITCAP
這三個函數(shù)更改提供給它們的文體的大小寫。
select upper(product_name) from product; select lower(product_name) from product; select initcap(product_name) from product;
函數(shù)INITCAP能夠整理雜亂的文本,如下:
select initcap(‘this TEXT hAd UNpredictABLE caSE') from dual;
(2)LENGTH
求數(shù)據(jù)庫列中的數(shù)據(jù)所占的長度。
select product_name,length(product_name) name_length from product order by product_name;
(3)SUBSTR
取子串,格式為:
SUBSTR(源字符串,起始位置,子串長度);
create table item_test(item_id char(20),item_desc char(25)); insert into item_test values(‘LA-101','Can, Small'); insert into item_test values(‘LA-102','Bottle, Small'); insert into item_test values(‘LA-103','Bottle, Large');
取編號:
select substr(item_id,4,3) item_num,item_desc from item_test;
(4)INSTR
確定子串在字符串中的位置,格式如下:
INSTR(源字符串,要查找的字符串,查找起始位置)
select instr(‘this is line one','line',1) from dual;
其返回值為子串在源字符串中從起始位置開始第一次出現(xiàn)的位置。上面例子的返回值為9。
select item_desc , instr(item_desc,',',1)from item_test;
(5)LTRIM、RTRIM和TRIM
去除字符串左邊的空格、去除字符串右邊的空格、去除字符串左右兩邊的空格。
select ltrim(‘ abc def ‘) from dual;
以上就是Oracle文本函數(shù)的用法介紹,希望對大家的學(xué)習(xí)有所幫助。
- Oracle 函數(shù)大全[字符串函數(shù),數(shù)學(xué)函數(shù),日期函數(shù)]
- Oracle 系統(tǒng)變量函數(shù)用法指南
- Oracle to_char函數(shù)的使用方法
- Oracle過程與函數(shù)的區(qū)別分析
- oracle中的trim函數(shù)使用介紹
- Oracle to_date()函數(shù)的用法介紹
- Oracle定義DES加密解密及MD5加密函數(shù)示例
- oracle的nvl函數(shù)的使用介紹
- Oracle排名函數(shù)(Rank)實例詳解
- Oracle數(shù)學(xué)相關(guān)函數(shù)小結(jié)
相關(guān)文章
Oracle使用MyBatis中RowBounds實現(xiàn)分頁查詢功能
這篇文章主要介紹了Oracle使用MyBatis中RowBounds實現(xiàn)分頁查詢 ,本文通過實例代碼給大家介紹的非常詳細,具有一定的參考借鑒價值,需要的朋友可以參考下2019-07-07
oracle ora-00054:resource busy and acquire with nowait speci
這篇文章主要介紹了oracle ora-00054:resource busy and acquire with nowait specified解決方法,需要的朋友可以參考下2015-12-12
Oracle生成不重復(fù)票號與LPAD,RPAD與NEXTVAL函數(shù)解析
這篇文章主要介紹了Oracle生成不重復(fù)票號與LPAD,RPAD與NEXTVAL函數(shù)解析,小編覺得還是挺不錯的,這里分享給大家,供需要的朋友參考。2017-10-10

