Introduction to Oracle Text functions _oracle

Source: Internet
Author: User

Oracle text functions make our common functions, and here are some examples of the use of Oracle text functions for your reference learning, hoping to give you a deeper understanding of Oracle text functions.

(1) UPPER, Lower and Initcap

These three function changes are provided to their stylistic case.

Select Upper (product_name) from product;

Select Lower (product_name) from product;

Select Initcap (product_name) from product;

function Initcap is able to organize cluttered text as follows:

Select Initcap (' This TEXT hAd unpredictable case ') from dual;


(2) LENGTH

Find the length of data in the database column.

Select Product_name,length (product_name) Name_length from product order by

Product_Name;

(3) SUBSTR

To take a substring, in the form:

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

CREATE TABLE Item_test (item_id char (), Item_desc char);

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_desc from

item_test;

(4) INSTR

Determines the position of the substring in the string, in the following format:

INSTR (source string, string to find, find starting position)

Select InStr (' This are line one ', ' line ', 1] from dual;

The return value is where the substring first appears in the source string from the start position. The return value for the example above is 9.

Select Item_desc, InStr (Item_desc, ', ', ', ', 1) from Item_test;

(5) LTRIM, RTrim and Trim

Remove the space to the left of the string, remove the space to the right of the string, and remove the space on both sides of the string.

Select LTrim (' abc def ') from dual;

The above is the Oracle text function usage Introduction, hoped that is helpful to everybody's study.

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.