Skip to content
Advertisement

SELECT INTO using Oracle

I’m trying to do a SELECT INTO using Oracle. My query is:

But I get the following error:

Any ideas what’s wrong?


The Standard behavior of the above should be as I originally thought: However Oracle implemented it totally differently in their own dialect of SQL Oracle Docs on Insert … Select

Advertisement

Answer

If NEW_TABLE already exists then …

If you want to create NEW_TABLE based on the records in OLD_TABLE …

If the purpose is to create a new but empty table then use a WHERE clause with a condition which can never be true:

Remember that CREATE TABLE … AS SELECT creates only a table with the same projection as the source table. The new table does not have any constraints, triggers or indexes which the original table might have. Those still have to be added manually (if they are required).

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement