Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: perl and long fields in oracle
Where's your error handling?
BTW If you're running Oracle8, you might look into the new *LOB types
which Tim Bunce has recently announced support.
John
groenveld_at_acm.org
#!/usr/bin/perl -w
use DBI;
use strict;
my $dbh = DBI->connect("dbi:Oracle:", "scott", "tiger",
{AutoCommit => 1}) or die $DBI::errstr;
$dbh->do("DROP TABLE foo")
or warn $DBI::errstr;
$dbh->do("CREATE TABLE foo (bar LONG)")
or die $DBI::errstr;
or die $DBI::errstr;
my $long = "this is a" . "." x 2000 . "test";
$sth->execute($long)
or die $DBI::errstr;
$sth->finish()
or die $DBI::errstr;
$stmt = "SELECT bar FROM foo";
$sth = $dbh->prepare($stmt)
or die $DBI::errstr;
$sth->execute()
or die $DBI::errstr;
my @row;
while ( @row = $sth->fetchrow_array ) {
die $DBI::errstr if $DBI::err;
print @row,"\n";
}
$sth->finish()
or die $DBI::errstr;
$dbh->disconnect()
or die $DBI::errstr; Received on Mon Dec 21 1998 - 14:02:16 CST