Hallo DBI users,
We are using DBI 1.20 together with DBD::Oracle 1.12 to
insert some data into an Oracle 9.2.0.1.0 Database.
No Problems in general but when a field containes spaces or tabs at the
right end , these are
truncated. Do we have to take special care of VARCHAR2 fields ??
the field is defined as
AUMESSAGEDEF varchar2(150) and may contain NULL
Code :
# $dbhandle is an open handle.
# $table contains the (valid ) table name
# $ins is a array ref of arrayrefs
# first arrayref containes column names,
# other arrayrefs values for the rows
# build up the sql String with parameters
my $columns=join ( ', ', @{$ins[0]} );
my $valstring= join ( ', ' , ('?') x scalar @{$ins[0]} );
my $sql= "INSERT INTO $table ( $columns ) VALUES ( $valstring) ";
print "$sql\n";
shift @ins;
#the actual sequence
my $err = 0;
my $sth=$dbhandle->prepare ($sql) or $err++;
for my $in (@ins) {
$sth->execute(@{$in}) or $err++;
}
#####
Thanks in advance
Carola Begemann