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 6955137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:41:51+00:00 2026-05-27T14:41:51+00:00

The vendor data we load in our staging table is rather dirty. One column

  • 0

The vendor data we load in our staging table is rather dirty. One column in particular captures number data but 40% of the time has garbage characters or random strings.

I have to create a report that filters out value ranges in that column. So, I tried playing with a combination of replace/translate like so

select replace(translate(upper(str),' ','all possible char'),' ','')
from table

but it fails whenever it encounters a char I did not code. Therefore, the report can never be automated.

Javascript has the isNaN() function to determine whether a value is an illegal number (True if it is and false if not).

How can I do the same thing with DB2?? Do you have any idea?

Thanks in advance.

  • 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-05-27T14:41:52+00:00Added an answer on May 27, 2026 at 2:41 pm

    A fairly reliable (but somewhat hackish) way is to compare the string to its upper- and lower-case self (numbers don’t have different cases). As long as your data that is bringing in characters only includes Latin characters, you should be fine:

    SELECT input, CASE
        WHEN UPPER(input) = LOWER(input) THEN TO_NUMBER(input)
        ELSE 0
    END AS output
    FROM source
    

    Another option would be to use the TRANSLATE function:

    SELECT input,
        CASE 
            WHEN TRANSLATE(CAST(input as CHAR(10)), '~~~~~~~~~~~~~', '0123456789-. ') = '~~~~~~~~~~' THEN CAST(input AS DECIMAL(12, 2))
            ELSE 0
        END AS num
    FROM x
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We recently got some data back on a benchmarking test from a software vendor,
Our vendor needs some access to our test server, and thus we send them
Our vendor-supported server's O/S only supports PHP 5.1.6, which limits us to ZF 1.6.
Background Our email vendor supports rss feeds for dynamic content, which we use successfully
My ERP Vendor has the following trigger on a table: SET ANSI_NULLS ON GO
I have some vendor data that has the SOH (ASCII character 1) as the
I am trying to design a data warehouse for a licensing vendor, who sells
We have a number of local Subscriptions that a vendor uses to Push us
A vendor has a data database (read only) that gets sent to us via
I am trying to make one query, to get some statistic data from database.

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.