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

  • Home
  • SEARCH
  • 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 7538075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:01:17+00:00 2026-05-30T07:01:17+00:00

We recently fixed an issue with the character encoding being read incorrectly into our

  • 0

We recently fixed an issue with the character encoding being read incorrectly into our system from the text files by making sure the file is UTF-8 and the Java code opens these files in UTF-8 encoding.

However, we had ended up adding a lot of records across the entire database tables with incorrect characters being inserted i.e. °F was read as �F. So even though we have fixed this now, we need to clean up the database tables now to rectify this anomaly.

Can anyone please suggest me ways to achieve this?

  • 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-30T07:01:19+00:00Added an answer on May 30, 2026 at 7:01 am

    I had a similar problem a while back. Luckily, the number of columns that it affected was limited to a small number, and those columns had the same name throughout the database.

    I solved this by writing a script that does the following:

    1. disable foreign key constraints
    2. build up a list of tables which contain the
      target columns
    3. update all the tables in your list using a
      REGEXP_REPLACE
    4. commit the data re-enable the constraints

    This used a healthy dose of dynamic SQL, pulling data from the user_constraints and user_tab_columns, filtering on the specific column names I was targeting.

    Here’s a rough skeleton to get you started, I’ve just thrown it together quickly, so it isn’t tested. Also, if you have triggers to worry about, you’ll need to disable those too:

    -- disable constraints
    BEGIN
        FOR c IN (
            SELECT c.owner, c.table_name, c.constraint_name, c.constraint_type
            FROM user_constraints c
            INNER JOIN user_tables t ON (t.table_name = c.table_name)
            AND c.status = 'ENABLED'
            AND c.constraint_type NOT IN ('C', 'P')
            ORDER BY c.constraint_type DESC
        )
        LOOP
            dbms_utility.exec_ddl_statement('alter table '||c.table_name||' disable constraint ' || c.constraint_name);
        END LOOP;
    END;
    
    -- do the updates
    BEGIN
        FOR t IN (
            SELECT table_name, column_name
            FROM user_tab_columns
            WHERE column_name = 'TEMPERATURE'
            AND data_type = 'VARCHAR2';
        )
        LOOP
            dbms_utility.exec_ddl_statement('UPDATE '||t.table_name||' SET ' ||t.column_name||' = '||''GOOD VALUE''||' WHERE '||t.column_name||' = '||''BAD VALUE'');
        END LOOP;
    END;
    
    -- re-enable constraints
    BEGIN
        FOR c IN (
            SELECT c.owner, c.table_name, c.constraint_name, c.constraint_type
            FROM user_constraints c
            INNER JOIN user_tables t ON (t.table_name = c.table_name)
            AND c.status = 'DISABLED'
            AND c.constraint_type NOT IN ('C', 'P')
            ORDER BY c.constraint_type ASC
        )
        LOOP
            dbms_utility.exec_ddl_statement('alter table '||c.table_name||' enable constraint ' || c.constraint_name);
        END LOOP;
    END;
    /
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Recently I have been looking into Cassandra from our new project's perspective and learned
Recently two users of our software from the same company started experiencing random closures
I was recently porting a project from GCC to clang(in which I fixed a
I recently had an issue after upgrading my .net framework to 4.0 from 3.5:
Recently, I started changing some of our applications to support MS SQL Server as
Recently our site has been deluged with the resurgence of the Asprox botnet SQL
Recently, I read an article entitled SATA vs. SCSI reliability . It mostly discusses
Recently I ran into this error in my web application: java.lang.OutOfMemoryError: PermGen space It's
Recently, I read a post on Stack Overflow about finding integers that are perfect
Recently I discovered a problem on the midas and I fixed it, the problem

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.