Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: perl and long fields in oracle

Re: perl and long fields in oracle

From: John D Groenveld <groenvel_at_cse.psu.edu>
Date: 21 Dec 1998 15:02:16 -0500
Message-ID: <75m9g8$nfe$1@tholian.cse.psu.edu>


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;

my $stmt = "INSERT INTO foo VALUES (:1)"; my $sth = $dbh->prepare($stmt)

        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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US