DBD/DBI failing to add a blank in a non-null field

dn_perl_at_hotmail.com
Date: 12/30/04


Date: 29 Dec 2004 16:49:01 -0800


I am running into a problem with inserting a blank (not null) in a
non-null field via a placeholder.

sqlplus> desc mytable
fld01 not null varchar2(16) .

In Perl code :

use strict;
use DBI ;

my $dbh ; # DBI-> connect has been used to set value of $dbh
# database is Oracle 9i on solaris
my $user_id = ' ' ; # single space char in the string
my $dst = $dbh->prepare(" insert into
mytable (fld01) values(? ) " );
$dst->execute( $user_id ) or die "sql call failed." ;
---------------

But I get a DBD error that a null value cannot be entered into fld01. I
set $user_id to single-blank to insert a non-null value into
mytable.fld01 .

How can I add one space to mytable.fld01 ?

TIA.