mysql 查询当前时间到毫秒_获取SQL语句执行时间(精确到毫秒)

4:在在数据库A创建统计SQL执行时间的存储过程

create or replace procedure pro_test_insert_clxsg

is

v_string varchar2(100);

v_misecond number;

v_second  number;

v_minute  number;

v_starttime TIMESTAMP;

v_endtime TIMESTAMP;

v_excute_time number;

cursor c_source is select clgjid from clxsg ;

begin

for r_source in c_source loop

select systimestamp into v_starttime from dual;

insert into sa.clxsg@to_orcl131 select * from clxsg where clgjid=r_source.clgjid;

commit;

select systimestamp into v_endtime from dual; --zxx_excute_time

v_string := to_char(v_endtime-v_starttime);

v_misecond := to_number(SUBSTR(v_string,INSTR(v_string,' ')+10,3));

v_second := to_number(SUBSTR(v_string,INSTR(v_string,' ')+7,2));

v_minute := to_number(SUBSTR(v_string,INSTR(v_string,' ')+4,2));

v_excute_time := v_minute*60*1000+v_second*1000+v_misecond;

insert into sa.zxx_excute_time

values('CLXSGJ',v_excute_time,to_char(v_starttime,'yyyy-mm-dd hh24:mi:ssxff'),to_char(v_endtime,'yyyy-mm-dd hh24:mi:ssxff'));

commit;

end loop ;

end;

分别创建CLXSG 、CLWFX、 GJX表的插入存储过程。

pro_test_insert_clwfx

pro_test_insert_gjx

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值