On Thu, 14 Feb 2002 11:18:50 -0500, Ronald J Kimball wrote:

>You are not inserting a NULL value, you are inserting the four-character
>string 'NULL'.  Try hw = NULL, without the quotes, instead.
>
>Also try placeholders for the variables.  Here's a shortened example:
>
>my $sth = $dbh->prepare(<<"EndOfSQL");
>  UPDATE ipmgt
>  SET    hw = NULL
>  WHERE  ip = ?
>EndOfSQL
>
>$sth->execute($oldip);
>

I'll just add what Ronald Kimball didn't mention (explicitely): if you
use placeholders, use of an undefined perl value will result in the
database using null.

my $sth = $dbh->prepare(<<"EndOfSQL");
  UPDATE ipmgt
  SET    hw = ?
  WHERE  ip = ?
EndOfSQL

$sth->execute(undef, $oldip);

The required order of the arguments is a bit unfortunate, but you just
have to live with it.

-- 
        Bart.

Reply via email to