The VARCHAR_FORMAT function returns a character representation of a timestamp in the format indicated by format-string.
If expression is a character or graphic string, it must not be a CLOB or DBCLOB and its value must be a valid string representation of a timestamp. For the valid formats of string representations of timestamps, see String representations of datetime values.
Leading and trailing blanks are removed from expression, and the resulting substring is interpreted as a timestamp using the format specified by format-string.
'YYYY-MM-DD HH24:MI:SS'
where:
The result is the varying-length character string that contains the argument in the format specified by format-string. format-string also determines the length attribute and actual length of the result. If either argument can be null, the result can be null; if either argument is null, the result is the null value.
The CCSID of the result is the default SBCS CCSID of the current server.
Syntax alternatives: TO_CHAR is a synonym for VARCHAR_FORMAT.
SELECT VARCHAR_FORMAT(RECEIVED,'YYYY-MM-DD HH24:MI:SS') INTO :TVAR FROM CORPDATA.IN_TRAY
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.