how to insert data into table using select query Oracle code example

Example 1: oracle insert from select

INSERT INTO my_table SELECT * FROM source_table;
INSERT INTO my_table (a, b, c) SELECT a, b, c FROM source_table;
INSERT INTO my_table (a, b, c) SELECT a, b, c FROM source_table s
	WHERE s.my_col > sysdate;

Example 2: oracle insert from select

INSERT INTO table
(column1, column2, ... column_n )
SELECT expression1, expression2, ... expression_n
FROM source_table
[WHERE conditions];

-- Basically, omit the VALUES clause when using SELECT for an insert into.

Tags:

Sql Example