Oracle Text Functions

Source: Internet
Author: User

Oracle Text Functions

Oracle Text Functions allow us to use common functions. The following describes the usage of several Oracle Text Functions for your reference and learning. We hope that you can have a deeper understanding of Oracle Text Functions.

(1) UPPER, LOWER, and INITCAP

These three function changes are provided to them in case sensitivity.

select upper(product_name) from product;select lower(product_name) from product;select initcap(product_name) from product;

The function INITCAP can organize messy text as follows:

select initcap(‘this TEXT hAd UNpredictABLE caSE') from dual;


(2) LENGTH

Evaluate the length of the data in the database column.

select product_name,length(product_name) name_lengthfrom productorder by product_name;

(3) SUBSTR

Substring. format:

SUBSTR (source string, starting position, substring length );

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');

Number:

select substr(item_id,4,3) item_num,item_descfrom item_test;

(4) INSTR

Determine the position of the substring in the string. The format is as follows:

INSTR (source string, the string to be searched, and the start position)

select instr(‘this is line one','line',1) from dual;

The return value is the position where the substring first appears in the source string. The return value in the preceding example is 9.

select item_desc , instr(item_desc,',',1)from item_test;

(5) LTRIM, RTRIM, and TRIM

Removes spaces on the left of the string, spaces on the right of the string, and spaces on both sides of the string.

select ltrim(‘ abc def ‘) from dual;

The above is an introduction to the usage of Oracle Text Functions, hoping to help you learn.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.