Oracle PL/SQL/Date Timezone/numtodsinterval

Материал из SQL эксперт
Перейти к: навигация, поиск

current_timestamp + numtodsinterval( 2, "hour" )

 
SQL>
SQL>
SQL>  column current_timestamp format a38
SQL>  select current_timestamp from dual;
CURRENT_TIMESTAMP
--------------------------------------
16-JUN-08 04.27.20.203000 PM -08:00
1 row selected.
SQL>  select current_timestamp + numtodsinterval( 2, "hour" ) current_timestamp from dual;
CURRENT_TIMESTAMP
--------------------------------------
16-JUN-08 06.27.20.284000000 PM -08:00
1 row selected.
SQL>
SQL> --



current_timestamp + numtoyminterval( 3, "month" ) current_timestamp

 
SQL>
SQL>
SQL>  select current_timestamp from dual;
CURRENT_TIMESTAMP
--------------------------------------
16-JUN-08 04.27.20.414000 PM -08:00
1 row selected.
SQL>
SQL>  select current_timestamp + numtoyminterval( 3, "month" ) current_timestamp from dual;
CURRENT_TIMESTAMP
--------------------------------------
16-SEP-08 04.27.20.514000000 PM -08:00
1 row selected.
SQL>
SQL> --



numtodsinterval(150000, "SECOND")

SQL> select numtodsinterval(150000, "SECOND") from dual;
NUMTODSINTERVAL(150000,"SECOND")
---------------------------------------------------------------------------
+000000001 17:40:00.000000000
SQL>



numtodsinterval(15000, "MINUTE")

SQL> select numtodsinterval(15000, "MINUTE") from dual;
NUMTODSINTERVAL(15000,"MINUTE")
---------------------------------------------------------------------------
+000000010 10:00:00.000000000
SQL>



numtodsinterval(1500, "HOUR")

SQL> select numtodsinterval(1500, "HOUR") from dual;
NUMTODSINTERVAL(1500,"HOUR")
---------------------------------------------------------------------------
+000000062 12:00:00.000000000
SQL>



numtodsinterval(150, "DAY")

SQL>
SQL> select numtodsinterval(150, "DAY") from dual;
NUMTODSINTERVAL(150,"DAY")
---------------------------------------------------------------------------
+000000150 00:00:00.000000000
SQL>



NUMTODSINTERVAL(3.25, "HOUR")

SQL>
SQL> select NUMTODSINTERVAL(3.25, "HOUR") from dual;
NUMTODSINTERVAL(3.25,"HOUR")
---------------------------------------------------------------------------
+000000000 03:15:00.000000000
SQL>



NUMTODSINTERVAL(x, interval_unit): convert the number x to an INTERVAL DAY TO SECOND with the interval for x supplied in interval_unit

SQL>
SQL> --NUMTODSINTERVAL(x, interval_unit): convert the number x to an INTERVAL DAY TO SECOND with the interval for x supplied in interval_unit.
SQL>
SQL> SELECT NUMTODSINTERVAL(1.5, "DAY") FROM dual;
NUMTODSINTERVAL(1.5,"DAY")
---------------------------------------------------------------------------
+000000001 12:00:00.000000000
SQL>