$sth = $dbh->prepare(qq{ INSERT INTO people (fullname, age) VALUES (?, ?) }); $sth->execute("Joe Bloggs", undef); #### WHERE ISNULL(age, xx) = ISNULL(?, xx) #### $where_clause = defined $age? "age = ?" : "age IS NULL";