I am trying to read a simple BLOB implemented as a LONG RAW in Oracle 8.1.7
using DBI 1.15 and DBD 1.06 I tried running a select on the column. I get
data back, but it is limited to ONLY 160 bytes.
I do know that there is more in there. I also have tried this on another
system with a different oracle rev, and I seem to always get the same
results? Any Ideas?
Here is the output:
unix-machine1% ./test.pl
Query will return 2 fields
Field names : IMAGE_SIZE RAW_IMAGE
Length is : 5547
Real length is : 160
unix-machine1% exit
Below is the code:
#!/usr/local/bin/perl
# Test DBI Program
use DBI;
use DBD::Oracle qw(:ora_types);
#use strict;
my $lob;
my $size;
my $user = "user";
my $password = "password";
my $dbh = DBI->connect("dbi:Oracle:host=database-server;sid=ORCL", $user,
$password)
or die "No db connection";
my $sth = $dbh->prepare( q{
select raw_image.image_size, raw_image.raw_image from raw_image
where account_no = '12345' and raw_ref_no = '20000255'
}) or die "no prepare";
#$sth->{LongReadLen} = 16384;
$sth->{LongTruncOk} = 1;
my $rc = $sth->execute or die "no execute";
print "Query will return $sth->{NUM_OF_FIELDS} fields\n";
print "Field names : @{ $sth->{NAME} }\n";
($size, $lob) = $sth->fetchrow;
$sth->finish;
print "Length is : $size\n";
print "Real length is : ", length($lob), "\n";
open(TEST, ">ddd");
syswrite TEST, $lob, $size;
close(TEST);
die $sth->errstr if $sth->err;
$dbh->disconnect;
-Don Schleede
Adelphia Communications
716-819-0784
[EMAIL PROTECTED]