procedure GetALLPaymentApply(p_vehicleno in employforeignvehicle.vehicleno%type) is
p_pickupmode varchar2(200) ;
P_yuqitianshu number ;
begin
-- select count(o.pickupmode) into from
select o.pickupmode into p_pickupmod from orders o,ordertrack od where od.licenseplateno=p_vehicleno and od.licenseplateno=o.orderid;
-- p_pickupmode:=o.pickupmode;
if(p_pickupmode ='直送') then
if(p_pickupmode ='簽單') then
select
--dd.vehicleno 車牌號,
tt.licenseplateno 車牌號,
o.dzt 繳單狀態,
o.orderid 承運單號,
o.clearingform 付款方式,
decode(o.dzt,
'未交單',
round(sysdate - tt.departuretime - 0.03125, 0),
'已交單',
round((select ot.tracktime
from ordertrack ot
where ot.orderid = o.orderid
and ot.eventtype = '客戶簽收') -
tt.departuretime - 0.03125,
0)) 逾期天數,
decode(o.dzt,
'未交單',
round(sysdate - tt.departuretime - 0.03125, 0),
'已交單',
round((select ot.tracktime
from ordertrack ot
where ot.orderid = o.orderid
and ot.eventtype = '客戶簽收') -
tt.departuretime - 0.03125,
0)) * 50 罰款金額
from orders o,
longdistancetask tdt,
transporttrip tt
-- dispatchvehicle dd
--EmployForeignVehicle ev
where o.pickupmode = '直送'
and o.clearingform = '簽單'
and tdt.orderid = o.orderid
and tt.transporttripno = tdt.tripno
and decode(o.dzt,
'未交單',
round(sysdate - tt.departuretime - 0.03125, 0),
'已交單',
round((select ot.tracktime
from ordertrack ot
where ot.orderid = o.orderid
and ot.eventtype = '客戶簽收') - tt.departuretime -
0.03125,
0)) > 0
group by o.orderid, tt.licenseplateno,o.dzt,o.clearingform,o.dzt,tt.departuretime;
end if;
end GetALLPaymentApply;
uj5u.com熱心網友回復:
你寫了兩個 if ,但是只寫了一個 end if ;uj5u.com熱心網友回復:
if(p_pickupmode ='直送') then 后面加一個end if;
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/107617.html
標籤:開發
下一篇:oracle主從同步
