#!/usr/bin/perl -w

use DBI;
use DBD::Oracle qw(:ora_types);

my $dbh = DBI->connect("dbi:Oracle:host=hhhh;sid=ssss;port=1521",
                       "user", "password",
                       {AutoCommit => 1,
                        PrintError => 1,
                        RaiseError => 1});

my $id = 1;
my $string1 = "xxx";
my $string2 = "yyyy";
my $table = "T3";

#$dbh->do("drop table $table");

$dbh->do("create table $table (id integer primary key, dat1 clob, dat2 clob)");

my $sth = $dbh->prepare("insert into $table values (?,?,?)");
$sth->bind_param(1, $id);
$sth->bind_param(2, $string1, {ora_type => ORA_CLOB});
$sth->bind_param(3, $string2, {ora_type => ORA_CLOB});

$sth->execute;

$sth = $dbh->prepare("select * from $table");
$sth->execute;
while (my $row = $sth->fetchrow_hashref) {
  print "$row->{ID}: ", length($row->{DAT1}), "\n";
  print "$row->{ID}: ", length($row->{DAT2}), "\n";
}

$dbh->disconnect;
