SQL Reference

VARCHAR

Character to Varchar:

>>-VARCHAR--(--character-string-expression----+-------------+--->
                                              '-,--integer--'
 
>----)---------------------------------------------------------><
 

Datetime to Varchar:

>>-VARCHAR--(--datetime-expression--)--------------------------><
 

Graphic to Varchar:

>>-VARCHAR--(--graphic-string-expression--+-------------+--)---><
                                          '-,--integer--'
 

The schema is SYSIBM.

The VARCHAR function returns a varying-length character string representation of a character string, datetime value or graphic string (UCS-2 only).

The result of the function is a varying-length string (VARCHAR data type). If the first argument can be null, the result can be null; if the first argument is null, the result is the null value.

Graphic to Varchar is valid for a UCS-2 database only. For non-Unicode databases, this is not allowed.

Character to Varchar

character-string-expression
An expression whose value must be of a character-string data type other than LONG VARGRAPHIC and DBCLOB, with a maximum length of 32 672 bytes.

integer
The length attribute for the resulting varying-length character string. The value must be between 0 and 32 672. If this argument is not specified, the length of the result is the same as the length of the argument.

Datetime to Varchar

datetime-expression
An expression whose value must be of a date, time, or timestamp data type.

Graphic to Varchar

graphic-string-expression
An expression whose value must be of a graphic-string data type other than LONG VARGRAPHIC and DBCLOB, with a maximum length of 16 336 bytes.

integer
The length attribute for the resulting varying-length character string. The value must be between 0 and 32 672. If this argument is not specified, the length of the result is the same as the length of the argument.

Example:


[ Top of Page | Previous Page | Next Page ]