insert ignore into table1
select \'value1\',value2
from table2
where table2.type = \'ok\'
When I run this I get the error \"missing INTO keyword
Because you typed the spurious word "ignore" between "insert" and "into"!!
insert ignore into table1 select 'value1',value2 from table2 where table2.type = 'ok'
Should be:
insert into table1 select 'value1',value2 from table2 where table2.type = 'ok'
From your question title "oracle insert if row not exists" I assume you thought "ignore" was an Oracle keyword that means "don't try to insert a row if it already exists". Maybe this works in some other DBMS, but it doesn't in Oracle. You could use a MERGE statement, or check for existence like this:
insert into table1
select 'value1',value2 from table2
where table2.type = 'ok'
and not exists (select null from table1
where col1 = 'value1'
and col2 = table2.value2
);