oracle括号内传参,请教日期参数传入问题

这是一个Oracle数据库的存储过程示例,用于检查并清理'ydzs_5min'表,然后根据特定条件从'user_all_tables'和'wk_operationincome'中插入数据到'YDZS_5MIN'表。条件包括车辆位置、方向、速度和时间范围。
摘要由CSDN通过智能技术生成

Try!

create or replace procedure P_test_t(v_day in char, v_time in char)

authid current_user

is

vn_cnt number(10);

begin

select count(*)

into vn_cnt

from user_all_tables a

where a.table_name like upper('ydzs_5min');

if vn_cnt > 0 then

execute immediate 'truncate table ydzs_5min';

end if;

execute immediate

'insert into YDZS_5MIN

(id,

vehiclenum0,

longitude,

latitude,

direction0,

speed0,

locationtime0)

select rownum,

vp_vehiclenum,

round(vp_longitude - 0.002472, 6),

round(vp_latitude + 0.002476, 6),

round(vp_direction),

round(vp_speed, 1),

vp_locationtime

from system.vehicle_position partition (to_date(' || v_day || ', ''yyyymmdd'')),

(select *

from system.wk_operationincome partition (to_date(' || v_day || ', ''yyyymmdd''))

where getofftime > getontime)

where vp_longitude != 0

and vp_latitude != 0

and vp_direction != 0

and vp_direction >= 0

and vp_direction <= 360

and vp_vehiclenum = vehiclenum

and vp_locationtime between getontime and getofftime

and vp_locationtime >= to_date(' || v_day || ' ' || v_time || ', ''yyyymmdd hh24:mi:ss'') - 2 / 1440

and vp_locationtime <= to_date(' || v_day || ' ' || v_time || ', ''yyyymmdd hh24:mi:ss'') - 1 / 1440';

commit;

end;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值