I'll try and keep it short. I have code that opens an Oracle client and pipes
it a few SQL statements, including spool.
I've heard a lot about 'use strict' and I felt that my code was actually
organized well enough to pull this off, so I tried it.
The only change I made was to declare all variables 'my'. Now I watch the
system call to Oracle and I can see the data scrolling on the command screen
(NT), the spool files are created, but they're blank. I tried leaving the 'my'
declarations alone, and commented out 'use strict' and it still didn't work.
Does anyone familiar with 'use strict' know what may be going on?
(Please don't make fun of the way I'm accessing the database. It works, and
besides, I've been too lazy to learn about the DBI package/module thing.)
##############################
Original Oracle call (spooling works well):
sub callOracle {
$SQLline = shift;
# Connect to oracle, send SQL statements and close connection to Oracle
open (ORACLE, "|plus80.exe username/passwd\@DBT") || # Test
# open (ORACLE, "|plus80.exe username/passwd\@DBP") || # Production
die "Can't open connection to Oracle database: ";
print ORACLE $SQLline;
close ORACLE;
}
##############################
After 'use strict' (no output spooled):
sub callOracle {
my($SQLline) = shift;
# Connect to oracle, send SQL statements and close connection to Oracle
open (ORACLE, "|plus80.exe username/passwd\@DBT") || # Test
# open (ORACLE, "|plus80.exe username/passwd\@DBP") || # Production
die "Can't open connection to Oracle database: ";
print ORACLE $SQLline;
close ORACLE;
}
##############################
example of the SQL statement contained in $SQLline (all one string):
SET HEAD OFF;
SET SERVEROUTPUT OFF;
SET PAGESIZE 0;
SET ECHO OFF;
SET FEEDBACK OFF;
SPOOL d:\perldev\lookup\Guard_prov_fac.txt
select stuff||','||morestuff
from table
SELECT '%default%,' FROM DUAL;
SPOOL OFF;
EXIT;
##############################
****** CONFIDENTIALITY NOTICE ******
THIS E-MAIL, INCLUDING ANY ATTACHED FILES, MAY CONTAIN CONFIDENTIAL AND
PRIVILEGED INFORMATION FOR THE SOLE USE OF THE INTENDED RECIPIENT(S). ANY
REVIEW, USE, DISTRIBUTION, OR DISCLOSURE BY OTHERS IS STRICTLY PROHIBITED. IF
YOU ARE NOT THE INTENDED RECIPIENT (OR AUTHORIZED TO RECEIVE INFORMATION FOR
THE RECIPIENT), PLEASE CONTACT THE SENDER BY REPLY E-MAIL AND DELETE ALL COPIES
OF THIS MESSAGE. THANK YOU.