ITPub博客

首页 > Linux操作系统 > Linux操作系统 > oracle plsql定义date_timestamp_with time zone

oracle plsql定义date_timestamp_with time zone

原创 Linux操作系统 作者:wisdomone1 时间:2010-07-24 18:12:15 0 删除 编辑

Example 2-3 Using DateTime Literals

DECLARE
   d1 DATE := DATE '1998-12-25';
   t1 TIMESTAMP := TIMESTAMP '1997-10-22 13:01:01';
   t2 TIMESTAMP WITH TIME ZONE := TIMESTAMP '1997-01-31 09:26:56.66 +02:00';
-- Three years and two months
-- For greater precision, we would use the day-to-second interval
   i1 INTERVAL YEAR TO MONTH := INTERVAL '3-2' YEAR TO MONTH;
-- Five days, four hours, three minutes, two and 1/100 seconds
   i2 INTERVAL DAY TO SECOND := INTERVAL '5 04:03:02.01' DAY TO SECOND;
 
 
##一个小范例
SQL> set serveroutput on
SQL> r
  1  declare
  2  d1 date:=date'2010-02-21';
  3  begin
  4  dbms_output.put_line(d1);
  5* end;
21-2月 -10
PL/SQL procedure successfully completed.
 

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9240380/viewspace-669330/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
提供针对oracle初学者及进阶的数据库培训,欢迎大家咨询: 微信: wisdomone 微信公众号: lovedb 工作经历: 中国普天 北京科蓝 北京云和恩墨 北京神州新桥

注册时间:2008-04-04

  • 博文量
    2189
  • 访问量
    12690159