Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to dump table contents as SQL statements?

Re: How to dump table contents as SQL statements?

From: Andreas Michler <Andreas.Michler_at_adicom.de>
Date: Wed, 26 Jan 2000 08:10:00 +0100
Message-ID: <388E9DC8.7ED23F86@adicom.de>


try the following

spool xx
select 'insert into xx (field1,field2,field3) values ('||field1||','||field2||','||field3||');' from xx; spool off

after this you have a file called xx.log with the following statement:

insert into xx(field1,field2,field3) values(1,2,3);
insert into xx(field1,field2,field3) values(1,2,4);
insert into xx(field1,field2,field3) values(1,2,5);
insert into xx(field1,field2,field3) values(1,2,6);
insert into xx(field1,field2,field3) values(1,2,7);
....
You must remove the first two and the last line.

This works only with numeric fields.
With char,varchar or datefield you must put the char ' into your values clause.

Gopal Santhanam wrote:

> Hi,
>
> How do you dump the data contents of a table as a series of sql insert
> statements? I'd like to generate a sql script file that can be later
> loaded into an empty incarnation of the same table.
>
> I know there is such an animal in for MySQL.
>
> Gopal

--



ADICOM Informatik GmbH
Andreas Michler
Wiesfleckenstr. 34
72336 Balingen
Tel: 07433/9977-57,Fax: -90
E-Mail: Andreas.Michler_at_adicom.de
http:\\www.adicom.de
Received on Wed Jan 26 2000 - 01:10:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US