Oracle – Best Way to Create a Table with 800 Columns

oracle

I prepared a script to create a table with 800 columns but SQLPlus and SQL Developer are not reading the whole script as they probably read only 7499/2499 characters max. As an alternative I am thinking to divide the script into an initial create script with 200 columns and then alter table to add remaining columns in 200 chunks. My question is that what is the best practice to achieve this? Are there any cleaner alternatives. I searched google but could not find the relevant answers and most of them got closed by suggestion that the table should at first place not have these many columns and it is a design issue.

Note: I am trying to replicate a scenario in a legacy system by creating a local database. So I don't have the option to denormalize.


What is the best way to create a table with 800 columns in a single script?

Best Answer

The best way to run a very long script is not to load it into the editor, any editor.

Just reference it via @ and run it

So @my_script.sql and execute that.