Slim
Slim

Reputation: 1744

Missing keyword error in SELECT INTO statement

I have this simple query:

SELECT *
INTO assimilations
FROM assimilations_bk
WHERE client_number='123';

As you can see I'm trying to insert some values from one table to another. The both tables are exactly the same, but I'm still getting a strange error that I can not understand.

After running the query I'm getting this:

ORA-00905: missing keyword
00905. 00000 -  "missing keyword"
*Cause:    
*Action:
Error at Line: 7 Column: 6

regarding this line:

INTO assimilations

What am I missing here? The syntax seems ok to me, but obviously I'm missing a small part of it.

Upvotes: 2

Views: 8030

Answers (2)

Code Lღver
Code Lღver

Reputation: 15603

Your query should be this:

INSERT INTO assimilations 
     (SELECT * FROM assimilations_bk WHERE client_number='123');

Upvotes: 1

Robert
Robert

Reputation: 25753

Select into is used for set data to variable. If you want to copy data to new table you have to use it that way:

insert into assimilations
SELECT *
FROM assimilations_bk
WHERE client_number='123';

Upvotes: 4

Related Questions