Oracle PL/SQL Tutorial/Date Timestamp Functions/NUMTOYMINTERVAL

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

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>