Oracle – Generate Insert statements for result set in Oracle

oracleoracle11gresultset

Is there a tool for oracle that will generate insert statements for the resultset? I am using Oracle SQL developer if it makes any difference.

For example, for a query of a table select * from t1 where this = 'that'

Col1    Col2    Col3
a1      a2      a3
b1      b2      b3

I want to export the resultset to

INSERT INTO T1 (Col1, Col2, Col3) values ('a1', 'a2', 'a3');
INSERT INTO T1 (Col1, Col2, Col3) values ('b1', 'b2', 'b3');

Best Answer

Run your query in SQL Developer.

In the result grid, right click. Select Export...

A popup dialog is presented asking for how to export the result. The default is insert. You can select a file to save to, or copy to clipboard, or various other options.

This is on SQL Developer 3.0.4.

Related Topic