Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: how to dump data from oracle table to a flat file
In article <39932563$0$6691_at_wodc7nh1.news.uu.net>,
"Sajnish Gupta" <sajnish_gupta_at_yahoo.com> wrote:
> What's the best method to dump all of the table data to a flat file and make
> modifications to this data. I don't want to just output all the data in
> sqlplus because the data set is very large, also I am shying to make the
> modifications of data AFTER it is completely dumped to the flat file because
> of the size issue again.
>
> thanks
> SG
>
>
Go the perl DBI way
Make a little Perl script using the DBI module, call this dump.pl:
#!/usr/bin/perl
#USAGE: [you_at_host] ~ >> perl dump.pl > table_dump.tab
use DBI;
$drh = DBI->install_driver('Oracle');
$dbh = DBI->connect( 'dbi:Oracle:', '<username>@<SID>', '<passwd>' )
or die "Can't connect to database: $DBI::errstr";
$data_query = "select * from <table_name>"; $sth1 = $dbh->prepare($data_query) or die $DBI::errstr; $sth1->execute; while (@data = $sth1->fetchrow) { print OUT join("\t",@data),"\n"
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Fri Aug 11 2000 - 00:00:00 CDT