[I posted this to perl.dbi.users using Google a couple days ago, but so far I
have yet to see it appear on nntp.perl.org/group/perl.dbi.users.  So please
forgive me if you've already seen it...still desperately seeking an answer.]

I hope someone can help me; I've been all over the 'net in an effort to solve
this.  I've tried every documented method I could find with no success.

I am trying to fetch a column with datatype LONG using DBI version 1.23, Oracle
DBD version 1.12, Oracle client v8.1.7, and Oracle server 7.3.4.  I know that
the value inserted into the column is intact, about 500 bytes, because I can
select it using SQL*Plus, but every time I try to fetch the column with DBI, it
gets truncated to 80 characters.

I have tried various large and small values for LongReadLen with the same
result.  I also tried setting LongReadLen as an attribute of the database
handle rather than the statement handle, also with the same result.  When I try
to eliminate the "LongTruncOk" attribute or set it to 0, I get an error 1406
(DBD ERROR: ORA-01406 error on field 2 of 2, ora_type 8, LongReadLen too small
and/or LongTruncOk not set).  It seems as if it's ignoring my LongReadLen value
and setting it to 80 regardless of what I put there.

I even tried using blob_read in a loop, but when I do that, I get an error to
the effect of "blob_read is not supported in this version, try setting
LongReadLen instead".

Here is my code snippet:

  $dbh->{RaiseError} = 1;

  # The actual query is in a package.
  my $sth = $Profile::DB::get_cust_profile;

  $sth->{LongReadLen} = 2147483647; # max length of LONG column
  $sth->{LongTruncOk} = 1;

  $sth->execute($login);
  ($seq, $profile) = $sth->fetchrow_array;

And, here's the output of a level-2 trace.  In the above code, line 46 is the
$sth->execute.

    DBI 1.22-nothread dispatch trace level set to 2
    Note: perl is running without the recommended perl -w option
    -> STORE for DBD::Oracle::db (DBI::db=HASH(0x81ec844)~INNER
'RaiseError' 1)
    <- STORE= 1 at prof_data line 36
    -> STORE for DBD::Oracle::st (DBI::st=HASH(0x8383000)~INNER
'LongTruncOk' 1)
    <- STORE= 1 at prof_data line 39
    -> STORE for DBD::Oracle::st (DBI::st=HASH(0x8383000)~INNER
'LongReadLen' 50000)
    <- STORE= 1 at prof_data line 40
    -> execute for DBD::Oracle::st (DBI::st=HASH(0x8382fb8)~0x8383000
'spltina')
       bind :p1 <== 'spltina' (type 0)
       bind :p1 <== 'spltina' (size 7/8/0, ptype 4, otype 1)
    dbd_st_execute SELECT (out0, lob0)...
    dbd_st_execute SELECT returned (SUCCESS, rpc0, fn4, out0)
    !! ERROR: 24345 'ORA-24345: A Truncation or null fetch error
occurred (DBD SUCCESS_WITH_INFO: OCIStmtExecute)'
    <- execute= '0E0' at prof_data line 46
    -> fetchrow_array for DBD::Oracle::st
(DBI::st=HASH(0x8382fb8)~0x8383000)
    <- fetchrow_array= ( '1'
'BQQRD0NvbnRyYWN0dWFsRGF0YQMAAAAGBBEKUHJlZmVyZW5jZQMAAAADCgh0ZWFtL05ITAAAAAhjYXRl'
) [2 it
ems] row1 at prof_data line 47
    -> errstr in DBD::_::common for DBD::Oracle::st
(DBI::st=HASH(0x8382fb8)~0x8383000)
    <- errstr= undef at prof_data line 50


And here is the output of perl -V:

Summary of my perl5 (revision 5.0 version 6 subversion 0)
configuration:
  Platform:
    osname=linux, osvers=2.2.17-8smp, archname=i386-linux
    uname='linux porky.devel.redhat.com 2.2.17-8smp #1 smp fri nov 17
16:12:17 est 2000 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 (Red Hat Linux 7.1 2.96-79)
    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.2.2.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 Mar 23 2001 12:49:50
  @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

Thanks,

--Tina

=====
[EMAIL PROTECTED], [EMAIL PROTECTED]
http://www.monster-island.org

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

Reply via email to