You can't quote NULL, therefore assign undef to your object and then pass to
execute.

Ilya Sterin

-----Original Message-----
From: Curt Russell Crandall
To: [EMAIL PROTECTED]
Sent: 3/21/01 10:03 AM
Subject: distinguishing NULL from "NULL"

I'm having a problem where my intention is to insert a NULL value into a
nullable float column, however the result ends up being a floating point
0.

I have an object created by Class::Struct that contains a field for each
row in a particular db table.  If I have no value to assign to a field,
I'm entering NULL:

i.e. $obj->member("NULL")

This works fine for (var)char datatypes, but apparently the string NULL
is
automatically converted to 0.000000 when I do:

my $sth = $dbh->prepare( <<EOF
insert into owner.table
(column1)
values (?)
EOF
);

$sth->execute($obj->member) or die .....

I've tried 2 things to correct this.  First, I tried using
$obj->member(NULL), however that is not allowed under strict
subs.  Second, I was advised to try $obj->member(undef), however that
caused a segmentation fault (? was replaced by nothing after
bind_param).

If I go into isql and manually type NULL... it works.  Does anyone know
how I can assign NULL to my object member variable and have it be
correctly interpreted as NULL and not "NULL"?

I'm running this on SunOS 5.6 using Sun's Perl 5.00404, DBI.pm 1.13,
DBD::Sybase 0.21 and Sybase 11.1.1.  Upgrading these is not possible...
I
just have to live with it.

Thanks,
Curt Crandall

Reply via email to