As spool command can not work in DBI, how can we spool a query output to
a file?

Somebody suggests me to use this:

#!/usr/local/bin/perl -w

open ORA, "| $ORACLE_HOME/bin/sqlplus -s $usr/$pasw" or die "Can't pipe
to sqlplus: $!";
print ORA "exec mystoredprocedure";
print ORA "set trimspool on pagesize 500 linesize 200 colsep '  '"
print ORA "spool output.txt"
print ORA "select * from mytable;\n";
print ORA "exit\n";
close ORA;

Which means we have to use another db connection within the DBI scripts,
is this the only way of doing it or there is some better way?

Thanks for your help.



Reply via email to