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/ ,如需转载,请注明出处,否则将追究法律责任。