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

Dear fellow monks, The title says it all : I can't get my script to write or read to/from a CLOB field in an Oracle table.
I followed the various examples from the documentation (using my table instead) and I keep getting again and again:
Can't locate object method "ora_lob_read" via package "DBI::db" at ./t +estoracl.pl line 81.
or
Can't locate object method "ora_lob_write" via package "DBI::db" at ./ +testoracl.pl line 68.

I even looked into the DBD::Oracle.pm file, and yes, the methods are there!

The versions are : Does anyone understand what I am missing?

#!/usr/bin/perl -w use strict; use DBI; use DBD::Oracle qw(:ora_types); my $host="10.1.31.207"; my $sid="ora9i"; my $user="iq"; my $passwd="iq"; $ENV{NLS_LANG}='french_france.WE8ISO8859P15'; my $dbh = DBI->connect("dbi:Oracle:host=$host;sid=$sid", $user, $passw +d) or die "aaaaargh: $!"; # JOB_MESSAGE is the only CLOB field in this table my $request="SELECT JOB_MESSAGE FROM JOBS WHERE JOB_ID='1' FOR UPDATE" +; my $sth = $dbh->prepare($request, { ora_auto_lob => 0 } ); $sth->execute() or die "aaaaargh: $!"; my ($jmess)=$sth->fetchrow_array(); my $offset = 1; # Offsets start at 1, not 0 my $chunk_size=4096; my $message="1 אחיט אחיט אחיט אחיט אחיט אחיט אחיט אחיט אחיט אחיט אחיט +\n"; # this one fails... $dbh->ora_lob_write( $jmess, $offset, $message ); $request="SELECT JOB_MESSAGE FROM JOBS WHERE JOB_ID='1' "; $sth=$dbh->prepare($request, { ora_auto_lob => 0 }); $sth->execute() or die "ooooooouch:$!"; ($jmess)=$sth->fetchrow_array(); print "JMESS $jmess\n"; # this one too... while (my $data=$dbh->ora_lob_read( $jmess, $offset, 4 )) { print $data; $offset+=4; }

Replies are listed 'Best First'.
Re: Oracle bites me again...
by Transient (Hermit) on Apr 26, 2005 at 16:23 UTC
    From DBD::Oracle -
    (If using a DBI version earlier than 1.36 they must be called via the func() method. Note that methods called via func() don't honour RaiseError etc, and so it's important to check $dbh->err after each call. It's recommended that you upgrade to DBI 1.38 or later.)
      What a fool I am....
      apt-get install libdbi-perl
      made my day. Thousand thanks to you, Transient.