In the Oracle database, a field exists with Chinese characters and numbers, and the number part

Source: Internet
Author: User

method One: Regexp_replace

Select T.achive_name,regexp_replace (T.achive_name, ' [^0-9] ') from T_archive_content t where t.plan_id= ' 402881ef5f702d62015f7128f2760089 ';

Tags: regexp_replace The parameter description of the regular function:
A total of 6 parameters, respectively, are
1. String to match
2. Regular expressions
3. Substituted characters
4, the identity starts from the first few characters regular expression matches. (Default is 1)
5. Identify the first few matching groups. (default to replace All)
6. Range of values:

Method Two: Regexp_substr

Select T.achive_name,regexp_substr (T.achive_name, ' [0-9]+ ') from T_archive_content t;

Method Three: TRANSLATE (' Pending replacement string ', ' 1234567890 ', ')

That is, replace the number in the string you want to replace with "'

Select T.achive_name,trim (TRANSLATE (T.achive_name, TRIM (TRANSLATE (t.achive_name, ' 1234567890 ', ")))
From T_archive_content T;

method Four: Intercept string substr (str,0,2)

Select T.achive_name,substr (t.achive_name,0,2) from T_archive_content t;

SUBSTR (String,start,length)

Parameters:

String-The specified string to intercept

Start-required to specify where the string begins

Positive number-starts at the specified position in the string

Negative number-starts at the specified position from the end of the string

0-Starts at the first character in a string

Length-optional, specifies the length of the string to intercept, by default returning all characters before the value of the character expression ends.

In the Oracle database, a field exists with Chinese characters and numbers, and the number part

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.