Robert Gould Robert Gould - 3 months ago 18
SQL Question

SELECT INTO using Oracle

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

SELECT * INTO new_table FROM old_table;


But I get the following error:

SQL Error: ORA-00905: missing keyword
00905. 00000 - "missing keyword"


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

APC APC
Answer

If NEW_TABLE already exists then ...

insert into new_table select * from old_table
/

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

create table new_table as select * from old_table
/
Comments