create or replace procedure p_kgl_hoist(p_start_date in date, p_end_date in date) isbegin insert into kgl_table select QUE_KGL_TIME.NEXTVAL as id, a.PROVINCE_NAME,a.province_id,a.tonnage,a.v_workingmachine,b.TOTALOFMACHINE,a.TOTALWORKTIME,a.AVETIMEOFWORKING,trunc(nvl(a.v_workingmachine/b.TOTALOFMACHINE,0),4) _KGL,
p_start_date,p_end_date
from
(
select i.PROVINCE_NAME ,
i.province_id ,
i.tonnage ,
count(distinct t.C_VEHICLENO) as v_workingmachine,
trunc(nvl(sum(t.c_duration)/3600,0),2) as TOTALWORKTIME,
trunc(trunc(nvl(sum(t.c_duration)/3600,0),2) / count(distinct t.C_VEHICLENO),4) AVETIMEOFWORKING
from hoisting t, csu_info i
where t.C_VEHICLENO = i.vechileno and i.tonnage>0
and t.c_start_time >=p_start_date and t.c_start_time <p_end_date
group by i.PROVINCE_NAME,i.province_id, i.tonnage
order by i.PROVINCE_NAME, i.tonnage, TOTALWORKTIME desc
) a,
(
select i.PROVINCE_NAME , i.tonnage ,count(distinct i.vechileno) as TOTALOFMACHINE from csu_info i,_vehicle v where i.vechileno=v.VMARK
and
v.REGISTEREDDATE <p_end_date
group by i.PROVINCE_NAME, i.tonnage order by i.PROVINCE_NAME, i.tonnage desc
) b
where a.tonnage=b.tonnage and a.PROVINCE_NAME=b.PROVINCE_NAME;
end p_kgl_hoist ;
输入参数后为什么查询不出数据?
p_start_date,p_end_date
from
(
select i.PROVINCE_NAME ,
i.province_id ,
i.tonnage ,
count(distinct t.C_VEHICLENO) as v_workingmachine,
trunc(nvl(sum(t.c_duration)/3600,0),2) as TOTALWORKTIME,
trunc(trunc(nvl(sum(t.c_duration)/3600,0),2) / count(distinct t.C_VEHICLENO),4) AVETIMEOFWORKING
from hoisting t, csu_info i
where t.C_VEHICLENO = i.vechileno and i.tonnage>0
and t.c_start_time >=p_start_date and t.c_start_time <p_end_date
group by i.PROVINCE_NAME,i.province_id, i.tonnage
order by i.PROVINCE_NAME, i.tonnage, TOTALWORKTIME desc
) a,
(
select i.PROVINCE_NAME , i.tonnage ,count(distinct i.vechileno) as TOTALOFMACHINE from csu_info i,_vehicle v where i.vechileno=v.VMARK
and
v.REGISTEREDDATE <p_end_date
group by i.PROVINCE_NAME, i.tonnage order by i.PROVINCE_NAME, i.tonnage desc
) b
where a.tonnage=b.tonnage and a.PROVINCE_NAME=b.PROVINCE_NAME;
end p_kgl_hoist ;
输入参数后为什么查询不出数据?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货