ORACLE-018: ORACLE tip 001 string processing, oracle-018oracle

Source: Internet
Author: User

ORACLE-018: ORACLE tip 001 string processing, oracle-018oracle

1. truncate a string

Oracle uses a function substr to intercept a string. The parameter is substr (string, start position, and truncation length ),

For example, if the string 123,112 needs to be removed by a comma, the truncation function is as follows:

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

Result: 123,112

2. Replace string

Function: replace,

As follows:

Select replace ('Think that year, Jin Ge tie Ma, swallowed thousands of miles like a tiger ', 'tiger', 'Wolf ') from dual;

Result: The Golden gotie horse swallowed up like a wolf.

3. String concatenation

Concatenates a string with a pair of | symbols. If a string contains single quotes, double single quotes are used, representing a single quotation mark, and so on.

For example:

Select '(A. SerialID IN (' | 123 | ') or nvl (A. SerialID, '0 '')! = '0') 'from dual;

Result:

(A. SerialID IN (123) or nvl (A. SerialID, '0 ')! = '0 ')

 

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.