thomaszhwang
asked on
Is there any difference between the following two statements in Oracle?
SELECT * INTO tableA FROM tableB;
INSERT INTO tableB SELECT * FROM tableA;
Thanks.
INSERT INTO tableB SELECT * FROM tableA;
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
INSERT INTO used when table exists, and SELECT INTO - when table does not exist
http://www.blackwasp.co.uk/SQLSelectInsert.aspx
http://www.blackwasp.co.uk/SQLSelectInsert.aspx
YZlat, that was covered already yesterday
ASKER
@sdstuber, I think you are right.
@YZlat, I tried to SELECT INTO a non-existing table, but it still failed. The following is my SQL.
SELECT col1, col2 INTO table2 FROM table1;
@YZlat, I tried to SELECT INTO a non-existing table, but it still failed. The following is my SQL.
SELECT col1, col2 INTO table2 FROM table1;
ASKER
Thanks.
In pl/sql you could do
SELECT * BULK COLLECT INTO tableA FROM tableB;
if tableA is a collection, see the pl/sql guides in the oracle documentation for more info
SELECT * BULK COLLECT INTO tableA FROM tableB;
if tableA is a collection, see the pl/sql guides in the oracle documentation for more info
ASKER