mifflin has asked for the wisdom of the Perl Monks concerning the following question:
Here is the outputuse strict; use warnings; use DBI; use DBU; print "$$ started\n"; my $dbh = DBI->connect('DBI:Oracle:dev', 'xxx', 'yyy', {PrintError => +1}); my $depts_sql = <<EOT; select d.id deptid from codes c, dept d where c.id = ? and nvl(d.cdt,sysdate+1) > sysdate and c.cd = d.id EOT my $depts_csr = $dbh->prepare($depts_sql); deptid($depts_csr); my $pid = fork; print "$$ pid = $pid\n"; if (!defined $pid) { print "$$ fork error\n"; } elsif ($pid == 0) { print "$$ child\n"; $dbh->{InactiveDestroy} = 1; # do something here in the child process exit; } deptid($depts_csr); # this call will succeed because the child has not + been reaped yet waitpid $pid, 0; deptid($depts_csr); # this call will fail $dbh->disconnect; sub deptid { my ($csr) = @_; $csr->execute('WVPLPRT'); print "depts="; while (my ($deptid) = $csr->fetchrow_array) { print "$deptid,"; } print "\n"; }
# perl problem 21754 started depts=1,10,11,13,14,15,17,18,19,2,20,21,23,27,3,30,5,9, 21754 pid = 21757 21757 pid = 0 21757 child depts=1,10,11,13,14,15,17,18,19,2,20,21,23,27,3,30,5,9, DBD::Oracle::st execute failed: ORA-01001: invalid cursor (DBD: oexfet + error) at problem line 42. DBD::Oracle::st fetchrow_array failed: no statement executing (perhaps + you need to call execute first) at problem line 44. depts=
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: DBI InactiveDestroy problem
by perrin (Chancellor) on Dec 02, 2006 at 17:38 UTC | |
by mifflin (Curate) on Dec 02, 2006 at 23:45 UTC | |
by perrin (Chancellor) on Dec 03, 2006 at 17:38 UTC | |
Re: DBI InactiveDestroy problem
by lbjay (Novice) on Dec 11, 2006 at 21:19 UTC | |
by mifflin (Curate) on Dec 14, 2006 at 01:59 UTC | |
Re: DBI InactiveDestroy problem
by etcshadow (Priest) on Jun 07, 2007 at 03:04 UTC |