Try it like this...

$insertCursor->bind_param(2,$tempval);

Ilya Sterin

-----Original Message-----
From: Baranitharan Santhanagopalan
[mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 26, 2001 2:33 AM
To: [EMAIL PROTECTED]
Subject: problems in inserting clob data using DBI Perl



hello,
  im using DBI::VERSION 1.6 and DBD::ORACLE::VERSION 0.59  on perl 5.0005_05
under AIX.
i tried to insert a data of large size into a oracle table  which has field
of clob data_type.
i encounter error like "Error : Insert Error ORA-01461: can bind a LONG
value only for insert into a LONG column (DBD: oex )"

#!/usr/local/bin/dbiperl
use DBI;
use DBD::Oracle qw(:ora_types);
use ebi_db;
#connection estabilished with oracle
$MainDBHandle->{LongReadLen}=64000;
$MainDBHandle->{LongTruncOk}=0;
open(FILE,"< clobdata.txt") || die ("Open Error");
while(<FILE>)
{
$tempval.=<FILE>;
}
close(FILE);
$insertCursor=$MainDBHandle->prepare("insert into clob_test_table
(clob_fld_id,clob_fld_value) values (?,?)");
$insertCursor->bind_param(1,1);
$insertCursor->bind_param(2,$tempval,{ora_type=>ORA_CLOB,ora_field=>clob_fld
_value});
$insertCursor->execute(1,$tempval);
if (defined $DBI::err && $DBI::err != 0) {
                die("Insert Error $DBI::errstr \n");
}
$insertCursor->finish();
if (defined $DBI::err && $DBI::err != 0) {
                die("Finish Error $DBI::errstr \n");
}
#Connection disconnected .

Environment:AIX.
DBI::VERSION-1.06
DBD::Oracle - 0.59.
Perl 5.0005_05

while trying the fetch the clob data i encountered error like "ORA-03115:
unsupported network datatype or representation (DBD: odescr failed) at
clobtest"

#!/usr/bin/perl
use ebi_db;
use DBI;
use DBD::Oracle qw(:ora_types);

DBI->trace(3, "test.out");
&DatabaseLogin();
if (defined $DBI::err && $DBI::err != 0) {
                die("Login Error $DBI::errstr \n");
}
$MainDBHandle->{LongTruncOk} = 1;
$MainDBHandle->{LongReadLen} = 64000;
my $sql = "SELECT clob_fld_value FROM clob_test_table";
my $sth = $MainDBHandle->prepare($sql) or die $DBI::errstr;
$sth->execute or die $DBI::errstr;
my (@data) = $sth->fetchrow or die $DBI::errstr if $DBI::err;
my $blob = '';
my $lump = 4096; # use benchmarks to get best value for you
my $offset = 0;
while (1) {
my $frag = $sth->blob_read(0, $offset, $lump);
die $DBI::errstr if $DBI::err;
last unless defined $frag;
my $ll = length $frag;
last unless $ll;
$blob .= $frag;
$offset += $ll;
}
print $blob;
$sth->finish;

Please help/suggest.what could be done or this version of DBI supports xLOBs
etc.

Thanks in advance

barani




--

This e-mail may contain confidential and/or privileged information. If you
are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any
unauthorised copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.

Reply via email to