带参数存储过程写法
create or replace package body PKG_CheckVehicleInfo is
– Author : XIE
– Created : 2018/4/26 10:26:38
– Purpose : 检测车辆信息
– Pro_CheckOffLineDays :检测车辆离线天数
procedure Pro_CheckOffLineDays
as
v_vehicleID number; --车辆ID
v_Finally_Online_Time date; --最后在线时间
v_VehicleNum varchar2(50); --车牌号码
cursor cur_part is select vehicleid,finally_time,vehiclenum from
(select distinct t.vehicleid,max(t.devtime) finally_time from Reallocate t group by t.vehicleid) r
join vehicle v on r.vehicleid=v.id ;
Begin
open cur_part;
loop
fetch cur_part into v_vehicleID,v_Finally_Online_Time,v_VehicleNum;
exit when cur_part%notfound;
if ROUND(TO_NUMBER(sysdate - v_Finally_Online_Time))>30 then
insert into ALARMMESSAGE (VEHICLEID,VEHICLENUM,ALARMTYPE,CONTENT,ALARMTIME,NOWARNING,URGENCYDEGREE)
values (v_vehicleID,v_VehicleNum,‘离线预警’,‘车辆离线天数异常’,SYSDATE,0,2);
else
null;
end if;
end loop;
close cur_part;
end Pro_CheckOffLineDays;
end PKG_CheckVehicleInfo;
本文地址:https://blog.csdn.net/xyx_0300/article/details/107667929
下一篇: 史上最强的五个官场情妇 你最喜欢哪一个?