Toad World® Forums

reordering columns in a table


#1

is there a way to reorganize the columns (i.e. id assignment) in a table? new columns were added into the table but would like to have a more logical order to them


#2

There’s no way to do that without dropping and recreating the table.

If you rt-click the table from the schema browser and choose “rebuild table”, Toad will give you a way to rebuild the table and then re-insert the data. This is NOT a good choice if someone might be using the table while you are rebuilding it.

For more of an online rebuild (and if I remember correctly, this method requires the DBA Module), go to the main menu -> Optimize, -> DBMS Redefinition Wizard. If you google DBMS_REDEFINITION you can get the specifics on how this works.


#3

Check out the “rebuild table” command. It will create a script which renames the current table, gives you the ability to reorganize the columns in a create
table command, creates the table, then reinserts the data from the original table. Very handy!

If I recall correctly it has options for keeping the original renamed table. Very helpful when you are initially “playing” with the concept and as an automatic
backup, just in case.

From: edward.szekeres [mailto:bounce-edwardszekeres@toadworld.com]

Sent: Tuesday, October 28, 2014 12:43 PM

To: toadoracle@toadworld.com

Subject: [Toad for Oracle - Discussion Forum] reordering columns in a table

reordering
columns in a table

Thread created by edward.szekeres

is there a way to reorganize the columns (i.e. id assignment) in a table? new columns were added into the table but would like to have a more logical order to
them

To reply, please reply-all to this email.

Stop
receiving emails
on this subject.

Or
Unsubscribe from Toad for Oracle - General
notifications altogether.

Toad for Oracle - Discussion Forum

Flag
this post as spam/abuse.


#4

This works for me, thanks, have not used “Rebuild” before. As I really only have this need in development phases, typically I am the only person accessing the tables.


#5

Small suggestion. Do not reorganize table just because of column order, ever.

:slight_smile: