How to insert the records in a table with where clause

advertisements

How to insert the records in a table with where clause

I want to insert the values in a column of a same table, by the reference of another column values in same table by using where clause.


Insert into Table_1 (col_a, col_b)
select val_1, val_2 from dual
where 0 = (select count(*) from Table_1 where col_a = val_1);

This would prevent inserting the value twice.