user657592
user657592

Reputation: 1061

Insert into a table using values from another

I am trying to perform an insert using the following command:

insert into table2(COL1, COL2, COL3, COL4) values((select COL1 FROM table1 WHERE COL1 = 121212),120,10,"Y");

But I get the following error:

ERROR at line 1: ORA-00984: column not allowed here

Any help?

Upvotes: 0

Views: 41

Answers (1)

Justin Cave
Justin Cave

Reputation: 231821

INSERT INTO table2( col1, col2, col3, col4 )
  SELECT col1, 120, 10, 'Y'
    FROM table1
   WHERE col1 = 121212

should work.

Upvotes: 5

Related Questions