Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8350035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:11:17+00:00 2026-06-09T08:11:17+00:00

There is a Trim function that I can trim a specific character, but I

  • 0

There is a Trim function that I can trim a specific character, but I was wondering if it could trim integers.

I have a list of strings:

'ABC01'
'ABCD02'
'AB5123'

Length and number are irregular.
After I run a SQL command, I would like to get this:

'ABC'
'ABCD'
'AB'
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T08:11:20+00:00Added an answer on June 9, 2026 at 8:11 am

    I would use the translate function. The REGEXP functions in Oracle tend to be CPU hogs compared to the simpler text processing functions.

    select translate(string, 'A1234567890', 'A')
    from t;
    

    The “A” at the beginning of the second parameter, and matching A for the last parameter translates “A”s to “A”s, doing nothing, but without something in the third parameter string, ORACLE will return null.

    EDIT Simple test case

    SQL> create table t (string varchar2(100));
    Table created.
    SQL> insert into t values ('ABC01');
    1 row created.
    SQL> insert into t values ('ABCD02');
    1 row created.
    SQL> insert into t values ('AB5123');
    1 row created.
    SQL> insert into t values ('ABCDEFGHIJKLMNOPQRSTUVWXYZ'
      2      || 'abcdefghijklmnopqrstuvwxyz1234567890');
    1 row created.
    SQL> insert into t values ('123AB456');
    1 row created.
    SQL> insert into t values ('!Whatever!1');
    1 row created.
    SQL> commit;
    Commit complete.
    
    SQL> select translate(string, 'A1234567890', 'A')
      2  from t;
    
    TRANSLATE(STRING,'A1234567890','A')
    ---------------------------------------------------
    ABC
    ABCD
    AB
    ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
    AB
    !Whatever!
    
    6 rows selected.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any function that I can use to parse any string to ensure
Is there any method that invokes a function but sets the context this to
Say I have a function that accepts an enum decorated with the Flags attribute.
I have an array of strings. I want to trim each string in the
I have a JQuery function that grabs the URL path and adds it as
I have created a javascript filter that is working but not all the time.
I have a code like this: $(function() { if ($(div#ProductDetail_ProductDetails_div2 table tbody tr).text().trim() ==
i have this function in jquery that verify if ALL the fields have at
I have about 3 different errors that can occur while loading the same page.
I have a string that I trim first to remove extra characters and store

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.