Oracle-空值null和数字相加的问题-nvl函数


select t.RECORD_ID as recordId,
       t.HOST_ID as hostId,
       t.HOST_NO as carHostNO,
       t.SECURE_PAY as securePay,
       p.VEHICLE_MODEL as vehicleModel,
       po.APPSYSID as appSysId,
       po.APPDEPTID as appDeptId,
       t.SECURE_NO as secureNo,
       to_char(t.SECURE_START_TIME, 'yyyy-MM-dd HH24:mi:ss') as secureStartTime,
       to_char(t.SECURE_END_TIME, 'yyyy-MM-dd HH24:mi:ss') as secureEndTime,
       t.SECURE_HANDLE as secureHandle,
       t.secure_acc_no as secureAccNo,
       t.secure_acc_pay as secureAccPay,
       t.secure_tax as secureTax,
       t.secure_remark as secureRemark,
       (t.SECURE_PAY + t.secure_acc_pay + t.secure_tax) as SECURE_NUM
  from CAR_SECURE_NEW t, POSITION_HOST_INFO_EXTEND p, POSITION_HOST_INFO po
 where t.host_id = p.hostid
   and t.host_id = po.hostid

Oracle-空值null和数字相加的问题-nvl函数_第1张图片

解决办法:若有空值,要用nvl函数来处理

Oracle-空值null和数字相加的问题-nvl函数_第2张图片


你可能感兴趣的:(Orale,MySQL)