How does DBD::Oracle handle NULL values?
Submitted by admin on Sun, 2005-11-06 02:46.
NULL values are treated as the value "undef" in DBI. Use one of the following methods to insert NULLs into an Oracle database:
$rc = $dbh->do("INSERT INTO tableName VALUES(SYDDATE, NULL)");
or...
$sth = $dbh->prepare(qq{ INSERT INTO tableName VALUES (?, ?) });
$sth->execute("10-JUN-2005", undef);
When queried, NULLs should be tested against undef. Example:
if (!defined $var) { ...
»
- Login to post comments

