随笔-204  评论-90  文章-8  trackbacks-0

以下为oracle时间运算:

alter  session  set  nls_date_format = ' yyyy-mm-dd hh24:mi:ss ' ;
 
declare  DateValue date; 
 
begin  
 
select  sysdate  into  DateValue  from  dual; 
 dbms_output.put_line(
' 源时间: ' || to_char(DateValue)); 
 dbms_output.put_line(
' 源时间减1天: ' || to_char(DateValue - 1 )); 
 dbms_output.put_line(
' 源时间减1天1小时: ' || to_char(DateValue - 1 - 1 / 24 )); 
 dbms_output.put_line(
' 源时间减1天1小时1分: ' || to_char(DateValue - 1 - 1 / 24 - 1 / ( 24 * 60 ))); 
 dbms_output.put_line(
' 源时间减1天1小时1分1秒: ' || to_char(DateValue - 1 - 1 / 24 - 1 / ( 24 * 60 ) - 1 / ( 24 * 60 * 60 ))); 
 
end ;
posted on 2006-12-05 16:08 一凡 阅读(736) 评论(0)  编辑  收藏 所属分类: DATABASE

只有注册用户登录后才能发表评论。


网站导航: