Alter multiple tables' columns length

Posted by gdoron on Stack Overflow See other posts from Stack Overflow or by gdoron
Published on 2012-09-05T09:36:56Z Indexed on 2012/09/05 9:37 UTC
Read the original article Hit count: 186

Filed under:
|
|
|
|

So, we just found out that 254 tables in our Oracle DBMS have one column named "Foo" with the wrong length- Number(10) instead of Number(3).

That foo column is a part from the PK of the tables.
Those tables have other tables with forigen keys to it.

What I did is:

  1. backed-up the table with a temp table.
  2. Disabled the forigen keys to the table.
  3. Disabled the PK with the foo column.
  4. Nulled the foo column for all the rows.
  5. Restored all the above

But now we found out it's not just couple of tables but 254 tables.

Is there an easy way, (or at least easier than this) to alter the columns length?

P.S. I have DBA permissions.

© Stack Overflow or respective owner

Related posts about sql

Related posts about database