in reply to Inserting a Long Raw into an Oracle table fails above 32512 bytes

jonnybuchanan,
FYI, long raw is limited to 32,760 bytes when used within PL/SQL. That tripped me up once. Here is the code I use to insert BLOBs into Oracle.
#!/usr/bin/perl use strict; use warnings; use DBD::Oracle qw(:ora_types); # Set up any Oracle environment variables needed my $dbh = DBI->connect('dbi:Oracle:db', 'user', 'pass') or die $DBI::e +rrstr; # Get data from file open(my $fh, '<', 'some.file') or die "Unable to open 'some.file' for +reading: $!"; binmode $fh; my $blob; { local $/ = undef; $blob = <$fh>; } my $sth = $dbh->prepare("UPDATE table SET col = ?") or die $dbh->errst +r; $sth->bind_param(1, $blob, {ora_type => ORA_BLOB}); $sth->execute() or die $dbh->errstr;
I have never had a problem with it.

Cheers - L~R

  • Comment on Re: Inserting a Long Raw into an Oracle table fails above 32512 bytes
  • Download Code

Replies are listed 'Best First'.
Re^2: Inserting a Long Raw into an Oracle table fails above 32512 bytes
by jonnybuchanan (Initiate) on May 16, 2008 at 16:31 UTC
    Thanks. This works for me when I change ORA_BLOB to a long raw. Thanks again. Jonathan.