A database *never* should accept an insert of an empty string in a not null column -
otherwise what for should a not-null-check to be set? On the otherhand your string is
not empty (1 blank: ' '), but in standard oracle is making an ltrim() on strings
before inserting to remove leading blanks - i guess. So Oracle would try to fill an
empty string ('') into the column, what has to be rejected because of
not-null-check.
Rajesh Yenumulapally wrote:
> F.Y.I
>
> The real error I am getting is the Oracle table does not accept null values, because
>all the columns are not null.And I guess that shouldn't matter since I am sending an
>empty string. The same script works on most of my other servers(inserting an empty
>string in a not null column) except the one which I showed it down below. Please
>email me if you have any questions. Thank You and have a great day.
>
>
>
> Rajesh Yenumulapally <[EMAIL PROTECTED]> wrote:
>
> Hi
> I wrote a script which uses a bind_param function of the DBI and it works perfectly
>fine on one server but
> not on the other one. My first server has the perl 5.003/DBI 0.79 and my second
>server has perl
> 5.6.0/DBI 1.13.I noticed that the bind param function stopped taking empty strings
>as one of the parameter
> on the new server.I am getting an error called "Bad file number" when I am trying to
>excute the
> statement. So is it the problem with the DBD::Oracle driver or the DBI version or
>the PERL version.
>
> Has any thing changed with the new versions of the drivers.Everything is working
>perfectly fine on my old server.Can any one
> please tell me what the problem is????
> the script is very simple and is as follows.......
> **********************************************************
>
> #!/usr/local/bin/perl
>
> use DBI; # Only for DBI
>
> print "Content-type: text/html\n\n";
>
> $lda = DBI->connect( 'dpscs4', 'meweb01', 'meweb01',Oracle );
>
> $sql = "insert into table_name ID_USER,ID_RACF,ID_ROLE,ID_LAST_UPDATE,
>DT_LAST_UPDATE)values(:TEST1,:TEST2,:TEST3,:TEST4,:TEST5)";
>
> $csr = $lda -> prepare($sql) || die $ora_errstr;
>
> $csr->bind_param(":TEST1","STEVE");
> $csr->bind_param(":TEST2"," "); # here it dosen't take an empty string
> $csr->bind_param(":TEST3","1");
> $csr->bind_param(":TEST4","RYENUMUL");
> $csr->bind_param(":TEST5","2000-12-09");
>
> if( $csr -> execute )
> {
> print "Could execute\n";
>
> $ret = $lda->commit ;
> $csr -> finish;
> }
> else{
> print "Could not execute because: $!\n";
> }
>
> $ret = $lda->disconnect;
>
> ---------------------------------
> Do You Yahoo!?
> Yahoo! Auctions - Buy the things you want at great prices.
>
> ---------------------------------
> Do You Yahoo!?
> Yahoo! Auctions - Buy the things you want at great prices.
--
Mit freundlichen Grüßen
Hans-J. Krause
*****************************************
Dipl.-Ing. Hans-J. Krause
Technical University of Hamburg-Harburg
Dpt. of Production Technology I (AB 5-04)
Denickestr. 17
21073 Hamburg
Germany
tel. +49 (0)40 42878-2484
fax +49 (0)40 42878-2295
http://www.ft1.tu-harburg.de/
mailto:[EMAIL PROTECTED]
*****************************************