Looking at the O'Reilly Perl/DBI book(pg 153,
'Inserting and Updating LONG/LOB columns'),
I think it's better if you use bind params with a
datatype argument. I have not tried the following code,
but it should work:
use DBI qw(:sql_types);
my $dsn = "DBI:Oracle:foobar";
my $user = "foobar";
my $pass = "baz";
my $textfile = "testing.txt";
open (TEXT, "$textfile") or die "Couldn't open textfile: $!";
my $longText = join('', <TEXT>);
close(TEXT);
$dbh = DBI->connect($dsn, $user, $pass,{ RaiseError => 1})
or die "Could not connect to database! $DBI::errstr";
$sth = $$dbh->prepare(
'INSERT INTO table_name (key_name, long_description) VALUES (?, ?)
+';
$sth->bind_param( 1, 42);
$sth->bind_param(2, $longText, SQL_BLOB);
$sth->execute();