Start of change

NEXT_MONTH scalar function

The NEXT_MONTH function returns the first day of the next month after the specified date.

FL 507

Start of change
Passthrough-only expression: This function is passthrough-only and cannot run on Db2 for z/OS® without acceleration. For information about invoking this function, see Accelerating queries with passthrough-only expressions.
End of change
Read syntax diagramSkip visual syntax diagramNEXT_MONTH(datetime-expression )

The schema is SYSIBM.

datetime-expression
An expression that specifies a date after which the first day of the next month is to be returned. The expression must return a value that is a DATE, TIMESTAMP WITHOUT TIME ZONE, CHAR, VARCHAR, GRAPHIC, or VARGRAPHIC data type. CHAR, VARCHAR, GRAPHIC, and VARGRAPHIC are supported using implicit casting. If datetime-expression is a CHAR, VARCHAR, GRAPHIC, or VARGRAPHIC data type, it must be a valid string accepted by the TIMESTAMP scalar function and does not contain a time zone.

The result of the function is DATE. If the argument can be null, the result can be null. If the argument is null, the result is the null value.

Examples

  • The following example returns the date value of the first day of the next month after the date specified by the input:
    values next_month('2007-02-18')
          Result: 2007-03-01
End of change