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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:16:24+00:00 2026-06-08T07:16:24+00:00

We have a table EVAPP_INTERFACE that did not specify a scale or precision on

  • 0

We have a table EVAPP_INTERFACE that did not specify a scale or precision on a number of numeric columns. We need to modify the column definition to add appropriate scale and precision but we cannot change the order of the columns in the table. In order to accomplish this, we are doing the following

  • We copy all the data to a new table EVI
  • We set the numeric columns in the existing EVAPP_INTERFACE table to NULL
  • We change the precision of the EVAPP_INTERFACE columns
  • We copy the data back

When the data is copied back, however, some rows generate an exception because they exceed the new scale and/or precision settings (i.e. a value of 1 billion in a column that is supposed to store an interest rate).

ERROR : ORA-01438: value larger than specified precision allowed for this column 

I want to identify which column and which rows have this bad data.

First the duplicate table

 select count(*) into countTab from USER_TAB_COLUMNS where TABLE_NAME = 'EVI'; 
IF  (countTab <> 0) then 
    execute immediate 'drop table EVI';
    execute immediate 'create table EVI as (select * from EVAPP_INTERFACE)'; 
ELSE
    execute immediate 'create table EVI as (select * from EVAPP_INTERFACE)'; 
END IF;
execute immediate 'TRUNCATE TABLE EVAPP_INTERFACE';

Then, I change precisions: There are 226 such blocks throughtout the script.

 select count(*) into countCol from USER_TAB_COLUMNS where TABLE_NAME = 'EVAPP_INTERFACE' and COLUMN_NAME = 'PST_NUM' and DATA_SCALE is null; 
  IF    (countCol <> 0) then   
 execute immediate 'alter table EVAPP_INTERFACE modify PST_NUM NUMBER(14,2)' ; 
     DBMS_OUTPUT.put_line('  EVAPP_INTERFACE.PST_NUM has been modified to the required precision'); 
END IF; 

Then, I insert back the old data. This is where it bombs

 execute immediate 'INSERT INTO EVAPP_INTERFACE SELECT * from EVI';

So, I am not entirely sure if SQLERRM and SQLCODE will give the full stacktrace. And, I don’t have enough dataset to verify this. Can anyone confirm if there is anyway that I can find out which particular column is causing the issue? I have already provided NUMBER(14,2) as the precision for most columns, and if possible I want to erase the bad data instead of increasing precision. And since it is production data, I am not allowed to import the data to inspect it.

  • 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-08T07:16:27+00:00Added an answer on June 8, 2026 at 7:16 am

    You probably want to use DML Error Logging to log all the rows that have problematic data.

    I’m not sure why you’re using dynamic SQL everywhere– it would make much more conventional to create the table outside of the script rather than dropping & recreating it every time. That would allow you to use static SQL to refer to the table and would let you move lots of error checking into the compilation phase rather than the execution phase. I’ll assume, though, that you have solid reasons for wanting this to be entirely dynamic.

    You would need to create an error table (and you’d need to drop the error table if you’re going to drop the base table so that you can recreate it). And you would need to modify your INSERT to add a LOG ERRORS INTO. Something like

    dbms_errlog.create_error_table( 'EVAPP_INTERFACE', 
                                    'EVAPP_ERROR' );
    

    to create the error table and

    EXECUTE IMMEDIATE 
      'INSERT INTO evapp_interface ' ||
      '  SELECT * ' ||
      '    FROM evi ' || 
      '  LOG ERRORS INTO evapp_error ' ||
      '  REJECT LIMIT UNLIMITED';
    

    to insert the data into EVAPP_INTERFACE while writing any failures to EVAPP_ERROR (the error table we created in the step above).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have table with column Percentage varchar(10) Data in that table is Pecentage 2/10
Currently I have a column that is declared as a NUMBER. I want to
I have table that contains more than 12 millions of rows. I need to
I have table named A with column B defined int not null Primary Key
I have table that uses inline editing with ajax to modify the fields. The
I have table with around 70 000 rows. There is 6000 rows that i
I have table and this table contain result column with some entries. I just
I have table of data that is sorted as follows: Item | Sample |
I have table with two columns (varchar from, varchar to). This table represents connections
I have table defined with FlexiGrid. Call to all variables is ok. One column

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.