Hello All,

I am trying to use DBD::Oracle (1.12) to return the contents of a BFILE to
a webpage. It seems that the use of the the BFILE datatype is not
supported. Is there a work around for this? Here is the error message I
receive when I run the script:

Field 1 has an Oracle type (114) which is not explicitly supported at
<PATH>/Oracle.pm line 293, <STDIN> line 1.


Here is a copy of the code I am using:

--------------------------------------------------------
#!/usr/local/bin/perl -w

use strict;
use DBI;
use DBD::Oracle qw(:ora_types);
use CGI;  # library for doing CGI's

my ($query, $primarykey, $dbh, $sth, $pdf);
$query = CGI->new();
$primarykey = $query->param('file'); # primary key from query

# database handle
$dbh = DBI->connect('','scott','tiger', 'Oracle')
      or die "connect error: $DBI::errstr";

$dbh->{LongReadLen} = 500000;
# statement handle
$sth = $dbh->prepare('SELECT thefile FROM sample_docs WHERE id=?')
      or die "prepare error: $DBI::errstr";
$sth->execute($primarykey)
      or die "execute error: $DBI::errstr";

# get record
$pdf = $sth->fetchrow_hashref()
      or die "did not find record with primary key of $primarykey";

# output content-type header with MIME type for PDF,
# (note blank line at end) and data
print "Content-Type: application/pdf\n\n", $pdf->{'THEFILE'};

-----------------------------------------------------------------

Please help,
Damien

Reply via email to