当前所在位置:珠峰网资料 >> 计算机 >> Oracle认证 >> 正文
6种常见Oracle日期操作二
发布时间:2010/10/7 9:27:38 来源:www.xue.net 编辑:城市总裁吧
     5.Oracle有毫秒级的数据类型

  1)返回当前时间 年月日小时分秒毫秒select to_char(current_timestamp(5),'DD-MON-YYYY HH24:MI:SSxFF') from dual;

  2)返回当前 时间的秒毫秒,可以指定秒后面的精度(最大=9)select to_char(current_timestamp(9),'MI:SSxFF') from dual;

  6.计算程序运行的时间(ms)

  declare

  type rc is ref cursor;

  l_rc rc;

  l_dummy all_objects.object_name%type;

  l_start number default dbms_utility.get_time;

  begin

  for I in 1 .. 1000

  loop

  open l_rc for

  'select object_name  from all_objects '||

  'where object_id = ' || i;

  fetch l_rc into l_dummy;

  close l_rc;

  end loop;

  dbms_output.put_line

  ( round( (dbms_utility.get_time-l_start)/100, 2 ) ||

  ' seconds...' );

  end;

广告合作:400-664-0084 全国热线:400-664-0084
Copyright 2010 - 2017 www.my8848.com 珠峰网 粤ICP备15066211号
珠峰网 版权所有 All Rights Reserved