Hello Thomas,
LOBs are defined to be possibly very large. So you should use
ora_lob_write.
You should to something like this:
my $sth = $db->prepare( <<" SQL" ) or die "insert $DBI::errstr";
INSERT INTO clob
( id, txt )
VALUES ( ?, empty_clob() )
SQL
$sth->execute( $lob_id ) or die "execute insert $DBI::errstr";
$sth = $db->prepare( <<" SQL", { ora_auto_lob => 0 } ) or die "prepare select
$DBI::errstr";
SELECT txt
FROM clob
WHERE id = ?
FOR UPDATE
SQL
$sth->execute( $lob_id ) or die "execute select $DBI::errstr";
my ( $bin_locator ) = $sth->fetchrow_array() or die "fetch select $DBI::errstr";
$sth->finish();
open FH, $ARGV[1] or die "open";
my $chunk_size = 4096; # Arbitrary chunk size
# BEGIN WRITING BIN_DATA COLUMN
my $offset = 1; # Offsets start at 1, not 0
my $length = 0;
my $buffer = '';
while( $length = read( FH, $buffer, $chunk_size ) ) {
$db->ora_lob_write( $bin_locator, $offset, $buffer );
$offset += $length;
}
close FH;
}
Monday, August 23, 2004, 2:26:20 PM, you wrote:
TC> I am using the following:
$sth = $dbh->>prepare("insert into parsed_dtlogs
$sth = $dbh->>(id,service_name,xml_doc)
TC> values ($item,'".$service_save."',xmltype(?))") or die "Can't prepare SQL
TC> statement: $DBI::errstr\n";
$sth->>bind_param(1,$xml,ORA_CLOB);
$sth->>execute() or die "Can't execute SQL statement: $DBI::errstr\n";
cu
Wieland mailto:[EMAIL PROTECTED]