php访问oracle写sql不能换行

网络整理 - 08-30

如下程序是错误的

$sql="begin 

 update com_customer set exp_score=case when (nvl(exp_score,0)".$score_str.")<0 then 0 else nvl(exp_score,0)".$score_str."  end,last_changed_date=sysdate

 where customer_id=:customer_id;

end;";
                      $sth = DB::commWriteDB()->prepare($sql);
                $sth->bindParam(":customer_id",$cust_id);
           $result = $sth->execute();
 $sth->closeCursor();

把sql换成这样就是正确的了:="begin   update com_customer set exp_score=case when (nvl(exp_score,0)".$score_str.")<0 then 0 else nvl(exp_score,0)".$score_str."  end,last_changed_date=sysdate where customer_id=:customer_id;end;";

pdo还是无法处理换行符。