如何将 Oracle SQL 查询结果重定向到驱动器上的外部 CSV 文件,同时在 perl 中将它们打印到屏幕上
这是我打算做的
my $dbh = DBI->connect('dbi:ODBC:Test2', 'XXX', 'XXXX') || die ("Connection Failed \n");
$sql="select a,b from xxx";
my $sth = $dbh->prepare($sql);
$sth->execute();
my $dat;
while( $dat = $sth->fetchrow_hashref() ){ print ("$dat->{a}",print ("$dat->{b}" *这里我在屏幕上看到结果 }
**My main challenge is to get the results into a csv file on my local disk -- Any help would be appreciated.....**