Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: PERL , DBI , DBD and ORACLE

Re: PERL , DBI , DBD and ORACLE

From: farooq <farooqm_at_mail.com>
Date: 12 Dec 2001 06:25:25 -0800
Message-ID: <e8186d7.0112120625.6e7a934d@posting.google.com>

Ron Reidy <rereidy_at_indra.com> wrote in message news:<3C1670C3.D38D9B4C_at_indra.com>...
> farooq wrote:
> >
> > Hi,
> > We have oracle 8.1.5 running on AIX 4.3.1. I installed PERL 5.6 ,
> > DBI 1.20 and DBD-Oracle-1.12. When running a PERL programs, I am
> > getting this unusal problem. There is something wrong with this
> > combination, as the following message is generated when trying to
> > insert :
> >
> > DBD::Oracle::st execute failed: ORA-01400: cannot insert NULL into
> > ("SAC"."T_ANNPROG"."SYS_REC_ACTN_CD") (DBD ERROR: OCIStmtExecute) at
> > bad8i3.pl line 37.
> > ORA-01400: cannot insert NULL into
> > ("SAC"."T_ANNPROG"."SYS_REC_ACTN_CD") (DBD ERROR: OCIStmtExecute) at
> > bad8i3.pl line 37.
> > $ pwd
> >
> >
> > I am not sure if this is the right group I am posting to, but the PERL
> > guys referred to DB groups. Basically , the error shown above is from
> > a PERL program that is trying to insert into a database. The thing it
> > is complaining about is a blank space " " that it is considering as a
> > NULL. I can make the same insert with a blank space from SQL*PLUS, but
> > if I put in a blank space in the insert statement (where the field in
> > which I am trying to insert into is NOT NULLABLE), then I get this
> > error. Somehow, it is not recognizing the blank space ,and mistaking
> > it for a NULL, which souldn't be the case. I have tried a different
> > combination of PERL ( and its DBI and DBD). The weird thing is , on a
> > Oracle7.3.2 Database running on the same machine, with older version
> > of PERL ( and DBI,DBD), the same exact program just runs fine.
> >
> > Any help ? ANYONE ???
> >
> > Thanks
> > Farooq

Thanks for the help everyone. Finally figured it out. I am posting it here so that others can benefit, and not have to waste a whole day playing with installing different versions of PERL, DBI and DBD ( like me) .

Finally reading the Changes file, I found the database handle attribute
ora_ph_type, which sets the default binding. The basic problem was PERL/Oracle behaviour when inserting strings containing only blanks . This is the change that was made in the dbh connect part:

 {AutoCommit => 0, PrintError => 0, ora_ph_type => 96})

and it inserted correctly.

Thanks again for taking the time to reply. Received on Wed Dec 12 2001 - 08:25:25 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US