NumToYMInterval

From Oracle FAQ
Jump to: navigation, search

NumToYMInterval is a SQL function, available form Oracle 8i, that is used to convert a NUMBER to a INTERVAL YEAR TO MONTH literal.

[edit] Syntax

The syntax for the numtoyminterval function is:

numtoyminterval( number, expression )

Where:

  • number is the number to convert to an interval.
  • expression is the unit. It must be one of the following values: YEAR or MONTH.

[edit] Examples

SQL> SELECT NumToYMInterval(1, 'month') FROM dual;
NUMTOYMINTERVAL(1,'MONTH')
---------------------------------------------------------------------------
+000000000-01
SQL>  SELECT NumToYMInterval(1, 'year') FROM dual;
NUMTOYMINTERVAL(1,'YEAR')
---------------------------------------------------------------------------
+000000001-00