Hello, I have some (jpeg) blobs in oracle.
table looks like this: asset_id height width preview varchar2 varchar2 varchar2 blob Ihave the programming DBI book here, but it does not cover this very well. I just want to select a blob and write it to a file. No big deal. I have scoured the internet and found the following: But it chokes somehow? I can't figure it out. ### error is as follows: PS we use oracle 8i. $ getblob DBD::Oracle::st execute failed: ORA-00932: inconsistent datatypes (DBD: oexfet e rror, e.g., can't select LOB fields using DBD::Oracle built for Oracle 7) at ./g etblob line 23. ### Thanks, Scott ############################################# #! perl -w use DBI; # binding parameters to statements. # binding, placeholders, etc. pseudonames my $ref = { PrintError => 0, RaiseError => 1, AutoCommit => 0}; my $max_len = 2000000; my $dbh = DBI->connect("dbi:Oracle:xxx", "xxxxl", "xxx", $ref); $dbh->{LongReadLen} = $max_len; $sth = $dbh->prepare(qq{select preview from preview where asset_id = 'xxxxxxx'}); $sth->execute(); while (my $doc = $sth->fetchrow_array) { open (OUT, ">foo.jpg") or die $!; binmode(OUT); print OUT $doc; close(OUT); } $sth->finish; $dbh->disconnect;