Generate Insert script for existing table data [message #342159] |
Thu, 21 August 2008 10:22 |
Olivia
Messages: 519 Registered: June 2008
|
Senior Member |
|
|
Is theree any way to generate the insert script (with the data)
for an existing table.
In Toad, we can generate the DDL for a particular table.
Just curious if it can be done using any Tool.
Regards,
Oli
|
|
|
|
Re: Generate Insert script for existing table data [message #342176 is a reply to message #342170] |
Thu, 21 August 2008 11:13 |
Olivia
Messages: 519 Registered: June 2008
|
Senior Member |
|
|
Thanks for the reponse.
How it will generate the insert script? The statement you provided is for inserting data from one table to another only.
I want to know if insert sql script can be generated for a table containg data.
e.g, something like extract (Employee table)
then script generated should be say insert.sql and should have below statements:
INSERT INTO EMPLOYEE VALUES ( 1, 'MICHEL','CADOT',20)
/
INSERT INTO EMPLOYEE VALUES ( 2, 'OUTLAND','JIM',30)
/
..
assuming Employee table has 4 columns
Regards,
Oli
[Updated on: Thu, 21 August 2008 11:15] Report message to a moderator
|
|
|
|
|
|
|
Re: Generate Insert script for existing table data [message #342339 is a reply to message #342159] |
Fri, 22 August 2008 01:26 |
Olivia
Messages: 519 Registered: June 2008
|
Senior Member |
|
|
Quote: |
SQL> select 'insert into dual values ('''||dummy||''');' from dual;
'INSERTINTODUALVALUES('''||DUM
------------------------------
insert into dual values ('X');
1 row selected.
|
I needed to generate the insert script for a table and the above query did worked fine.
Thanks to Michel and Frank providing more info on it.
Regards,
Oli
|
|
|
Re: Generate Insert script for existing table data [message #343628 is a reply to message #342159] |
Wed, 27 August 2008 12:19 |
tyler_durden
Messages: 14 Registered: August 2008 Location: http://tinyurl.com/63fmwx
|
Junior Member |
|
|
Quote: |
In Toad, we can generate the DDL for a particular table.
Just curious if it can be done using any Tool.
|
There is a tool called PL/SQL Developer that does a *very* good job of creating such INSERT scripts for a list of tables specified.
That particular feature is for "Export Tables...", and hence the final script has "CREATE TABLE" statements by default.
The INSERT INTO statements could be specified for all rows of the table list, or for just a few (depending on the constraints) or avoided completely.
tyler_durden
|
|
|
|
|
Re: Generate Insert script for existing table data [message #346729 is a reply to message #346429] |
Tue, 09 September 2008 09:22 |
JRowbottom
Messages: 5933 Registered: June 2006 Location: Sunny North Yorkshire, ho...
|
Senior Member |
|
|
In Oracle's free development tool SQL Developer you can write any query, and then right click on the result set.
Amon other options is the option to save the data set as a set of Insert statements into the tavble of your choice.
|
|
|
|
|
|
|
|
|
|
|