asked on
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
my $dbh = DBI->connect('dbi:Oracle:host=x.x.x.x;sid=xxxx;port=1521',
'user', 'pass', { RaiseError => 1, AutoCommit => 0 });
open(my $outputFile, '>', 'file.tsv');
my $sth = $dbh->prepare('SELECT * FROM SCHEMA.TABLE');
$sth->execute;
my $row;
while ($row = $sth->fetchrow_arrayref)
{
print $outputFile join("|", @$row) . "\n";
}
END
{
$dbh->disconnect if defined($dbh);
}
print $outputFile join("|", @$row) . "\n";