MySQL Forums
Forum List  »  Perl

Re: setting a varchar field to (NULL) via DBI
Posted by: Bill Karwin
Date: June 16, 2006 05:27PM

To insert a NULL into a column in DBI, try using the Perl constant undef.
You may have to do this with query parameters, it's likely that you can't do it by interpolating the values into a string.

For example:

$sth = $h->prepare('INSERT INTO tablename (a, b, c, d) VALUES (?, ?, ?, ?)');
$sth->execute(1, 2, 3, undef);

Regards,
Bill K.

Options: ReplyQuote


Subject
Written By
Posted
Re: setting a varchar field to (NULL) via DBI
June 16, 2006 05:27PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.