$#lookupkey#=QETVAL('#lookupkey#');
if ($#lookupkey#==-1) $#lookupkey#='null';
//...


$query="update ... ";

if ($#lookupkey#!=0||$#lookupkey#=='null') $query.=" ,#lookupkey#=$#lookupkey# ";

$query.=" ...";
