DB2 Scalar functions - DAYOFMONTH


Volta a página anterior

Volta ao Menu das scalar functions

Volta ao Menu Principal


Desenvolvido por DORNELLES Carlos Alberto - Analista de Sistemas - Brasília DF. - cad_cobol@hotmail.com

DAYOFMONTH

The DAYOFMONTH function returns an integer between 1 and 31 that represents the day of the month.

DAYOFMONTH(expression )

The schema is SYSIBM.

expression
An expression that specifies the datetime value from which the day of the month is determined.
The expression must return a value that is a DATE, TIMESTAMP, CHAR, or VARCHAR data type.
In a Unicode database, the expression can also be a GRAPHIC or VARGRAPHIC data type. CHAR, VARCHAR, GRAPHIC, and VARGRAPHIC are supported by using implicit casting.
If expression is a CHAR, VARCHAR, GRAPHIC, or VARGRAPHIC data type, it must be a valid string that is accepted by the TIMESTAMP scalar function.

The result of the function is an INTEGER.
If the argument can be null, the result can be null; if the argument is null, the result is the null value.

Example

Set the host variable END_DAY to the day that the WELD LINE PLANNING project is scheduled to stop, by querying the PRENDATE column of the PROJECT table.

   
      SELECT DAYOFMONTH(PRENDATE) 
      INTO  :END_DAY 
      FROM   PROJECT 
      WHERE  PROJNAME = 'WELD LINE PLANNING'

The host variable END_DAY is set to 15.


© Copyright IBM Corp.