hey all,

I've found a bug in DBI-1.12/DBD::Oracle-1.30 relating to binding variables.

With the following table

#       create table a (aa int, bb char(20) not null, c char(5));

The following bind fails:

use DBI;

my $dbh = DBI->connect("dbi:Oracle:MDSSTEST", "<user>", "<pass>");

my $argh = $dbh->prepare ( "insert into a values ( ?,?,? ) " );

        $argh->bind_param(1, 1);
        $argh->bind_param(2, ' ');
        $argh->bind_param(3, ' ');
        
$argh->execute();

wheras:

        my $argh2 = $dbh->prepare ( " insert into a values ( 1,' ',' ' ) ");
        $argh2->execute();

works.

The first gets the error:

        DBD::Oracle::st execute failed: ORA-01400: cannot insert NULL into 
("MDSS"."A"."BB") (DBD ERROR: OCIStmtExecute) at /tmp/aab.p line 14.

which indicates to me that the ' ' is being interpreted as null by DBD::Oracle..

Anyways, this is a pretty critical error for us. I'm going to try to get a 
patch ready ASAP... if someone else has already done this, I'd appreciate 
getting it..

Ed 

Reply via email to