Oracle-018:oracle Tips 001 String Handling

Source: Internet
Author: User

1. Intercepting strings

The Oracle intercept string uses a function substr, with the parameters: substr (string, start position, intercept length),

For example: String 123,112, you need to remove the trailing comma, then the Intercept function is as follows:

Select  substr (' 123,112, ', 0,length (' 123,112, ')-1) from dual;

Results: 123,112

2. Replace string

Using functions: Replace,

As follows:


Result: think of that year, back, Qi swallow miles like wolves

3. String concatenation

String and string concatenation using | | Symbol, if there is a single quotation mark in the string, use double single quotes, which represents a single quotation mark, and so on.

For example:

Select ' (A.serialid in (' | | | 123| | ') OR NVL (A.serialid, ' 0 ')! = ' 0 ') ' from dual;

Results:

(A.serialid in (123) OR NVL (A.serialid, ' 0 ')! = ' 0 ')

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Oracle-018:oracle Tips 001 String Handling

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.