http://www.perlmonks.org?node_id=808330

astroboy has asked for the wisdom of the Perl Monks concerning the following question:

Here's a real weird one. I can successfully invoke SQL*Plus (Oracle's SQL shell) from a Perl script. However, if I create a DBI connection first, it fails. The SQL script, test.sql:
select sysdate from dual; exit
and the perl script:
#!/usr/local/bin/perl use DBI; my $dbh = DBI->connect('DBI:Oracle:', 'scott', 'tiger', {RaiseError => + 1}) || die DBI::errstr; my @cmd = ( 'sqlplus', '-s', 'SCOTT/tiger', '@test.sql' ); my $output = qx{@cmd}; my $retcode = $?; if ($? == -1) { die "Error: $?: $!"; } print $output;
which dies with:
Error: -1: No child processes at ./test.pl line 17.

However if I comment line 4, it works! Now it works for me on an older system. The differences are:

older system: Perl 5.10.0, DBI 1.609,DBD::Oracle.1.23, Centos 5.4, Oracle 11g release 1

new system: Perl 5.10.1, DBI 1.609, DBD::Oracle.1.23, Centos 5.4, Oracle 11g release 2

To try and eliminate Perl, I used the vendor version (5.8) on the new system. The only thing I can guess is that the version of Oracle makes a difference. But before I go to all of the trouble of reinstalling Oracle, I'm wondering if anyone can offer a reason for my problem, and a solution.

Note: the actual code in my app uses IPC::Cmd to handle the external command call (and deal with stderr and stdout, etc). I simply use qx{} the test case above to illustrate the unerlying problem. In the real code, the SQL script runs without error, but the return status is always -1