oracle plsql定義date_timestamp_with time zone

wisdomone1發表於2010-07-24

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部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-669330/,如需轉載,請註明出處,否則將追究法律責任。

相關文章