Oracle PL/SQL Tutorial/Date Timestamp Functions/NUMTOYMINTERVAL — различия между версиями

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

Текущая версия на 10:04, 26 мая 2010

NUMTOYMINTERVAL(1.5, "YEAR")

SQL> SELECT
  2    NUMTOYMINTERVAL(1.5, "YEAR")
  3  FROM dual;
NUMTOYMINTERVAL(1.5,"YEAR")
---------------------------------------------------------------------------
+000000001-06
SQL>


NUMTOYMINTERVAL(3.25, "MONTH")

SQL> SELECT
  2    NUMTOYMINTERVAL(3.25, "MONTH")
  3  FROM dual;
NUMTOYMINTERVAL(3.25,"MONTH")
---------------------------------------------------------------------------
+000000000-03
SQL>


NUMTOYMINTERVAL(x, interval_unit) converts the number x to an INTERVAL YEAR TO MONTH with the interval for x supplied in interval_unit.

You may set interval_unit to YEAR or MONTH.



SQL>
SQL> SELECT
  2    NUMTOYMINTERVAL(1.5, "YEAR"),
  3    NUMTOYMINTERVAL(3.25, "MONTH")
  4  FROM dual;
NUMTOYMINTERVAL(1.5,"YEAR")                                                 NUMTOYMINTERVAL(3.25,"MONTH")
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
+000000001-06                                                               +000000000-03
SQL>