I'm sorry to bring this up again - it has been covered before on the list,
but surprisingly nobody has come up with a solution.
If anyone has come up against this problem and has been able to solve it, or
even if you were unable to solve it, I'd love to hear from you!
Oh, and the solution: 'don't use cursors' isn't a viable one as I want to
traverse a table with tens of millions of records in it and I want to avoid
fetching the whole table in one go.
thanks!
doug
THE CODE:
#!/usr/bin/perl -w
use DBI;
use DBD::Oracle qw(:ora_types);
print "connecting to database... ";
$dbh = DBI->connect('DBI:Oracle:blah', 'blah', 'blah') || die
$dbh->errstr;
$dbh->{RaiseError} = 1;
print "done!\n";
print "preparing the cursor... ";
$sth = $dbh->prepare(q{
BEGIN OPEN :cursor FOR
SELECT c_client_name
FROM client;
END;
});
my $sth_curs;
$sth->bind_param_inout(":cursor", \$sth_curs, 0, { ora_type => ORA_RSET }
);
$sth->execute;
print "done!\n";
print "fetching... ";
while (@row = $sth_curs->fetchrow_array) {
if($row[0]){
print "result: $row[0]\n";
}
}
print "done\n";
THE PROBLEM:
When I execute it on my Redhat machine, this is what happens:
[djohnson@uklinux002 dev]$ ./test2.pl
connecting to database... done!
Segmentation fault
[djohnson@uklinux002 dev]$
However, when I execute the identical script on my DEC_ALPHA machine, it
runs fine. What is particularly surprising is the fact that the versions of
software on the DEC_ALPHA machine are older than those on the Redhat
machine.
SOFTWARE VERSIONS:
DEC_ALPHA:
kermit0:~$ perl -V
Summary of my perl5 (5.0 patchlevel 4 subversion 4) configuration:
Platform:
osname=dec_osf, osvers=x5.0, archname=alpha-dec_osf
uname='osf1 unxfpm.unx.dec.com x5.0 490 alpha '
hint=recommended, useposix=true, d_sigaction=define
bincompat3=y useperlio=undef d_sfio=undef
Compiler:
cc='cc', optimize='-O4', gccversion=
cppflags='-ieee -std -D__LANGUAGE_C__'
ccflags ='-fprm d -ieee -std -D__LANGUAGE_C__'
stdchar='unsigned char', d_stdstdio=define, usevfork=false
voidflags=15, castflags=0, d_casti32=define, d_castneg=define
intsize=4, alignbytes=8, usemymalloc=n, prototype=define
Linker and Libraries:
ld='ld', ldflags =''
libpth=/usr/shlib /usr/lib /usr/ccs/lib
libs=-ldbm -ldb -lm
libc=/usr/shlib/libc.so, so=so
useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags='-shared -expect_unresolved "*" -O4 -msym
-s'
Characteristics of this binary (from libperl):
Built under dec_osf
Compiled at Jun 9 1998 15:24:13
@INC:
/usr/lib/perl-5.004/lib/alpha-dec_osf/5.00404
/usr/lib/perl-5.004/lib
/usr/lib/perl-5.004/lib/site_perl/alpha-dec_osf
/usr/lib/perl-5.004/lib/site_perl
.
DBI-1.14
DBD-Oracle-1.06
Connected to:
Oracle8i Enterprise Edition Release 8.1.6.0.0 - Production
With the Partitioning and Parallel Server options
JServer Release 8.1.6.0.0 - Production
REDHAT:
Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
Platform:
osname=linux, osvers=2.2.5-22smp, archname=i386-linux
uname='linux porky.devel.redhat.com 2.2.5-22smp #1 smp wed jun 2
09:11:51 edt 1999 i686 unknown '
config_args='-des -Doptimize=-O2 -march=i386 -mcpu=i686 -Dcc=gcc
-Dcccdlflags=-fPIC -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux
-Dd_dosuid -Dd_semctl_semun -Di_db -Di_ndbm -Di_gdbm -Di_shadow -Di_syslog
-Dman3ext=3pm -Uuselargefiles'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
useperlio=undef d_sfio=undef uselargefiles=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usesocks=undef
Compiler:
cc='gcc', optimize='-O2 -march=i386 -mcpu=i686', gccversion=2.96
20000731 (experimental)
cppflags='-fno-strict-aliasing'
ccflags ='-fno-strict-aliasing'
stdchar='char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=4
alignbytes=4, usemymalloc=n, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -ldl -lm -lc -lcrypt
libc=/lib/libc-2.1.92.so, so=so, useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options:
Built under linux
Compiled at Aug 7 2000 10:59:51
@INC:
/usr/lib/perl5/5.6.0/i386-linux
/usr/lib/perl5/5.6.0
/usr/lib/perl5/site_perl/5.6.0/i386-linux
/usr/lib/perl5/site_perl/5.6.0
/usr/lib/perl5/site_perl
.
DBI-1.15
DBD-Oracle-1.06
Oracle8i Enterprise Edition Release 8.1.7.1.0 - Production
JServer Release 8.1.7.1.0 - Production