DBCLOB

Click to skip syntax diagram

Character to DBCLOB

Read syntax diagramSkip visual syntax diagram>>-DBCLOB (--character-expression------------------------------->
 
>--+--------------------------------+--)-----------------------><
   '-,--+-length--+--+------------+-'
        '-DEFAULT-'  '-,--integer-'
 

Graphic to DBCLOB

Read syntax diagramSkip visual syntax diagram>>-DBCLOB (--graphic-expression--------------------------------->
 
>--+--------------------------------+--)-----------------------><
   '-,--+-length--+--+------------+-'
        '-DEFAULT-'  '-,--integer-'
 

Integer to DBCLOB

Read syntax diagramSkip visual syntax diagram>>-DBCLOB--(--integer-expression--)----------------------------><
 

Decimal to DBCLOB

Read syntax diagramSkip visual syntax diagram>>-DBCLOB--(--decimal-expression--+----------------------+--)--><
                                  '-,--decimal-character-'
 

Floating-point to DBCLOB

Read syntax diagramSkip visual syntax diagram>>-DBCLOB------------------------------------------------------->
 
>--(--floating-point-expression--+----------------------+--)---><
                                 '-,--decimal-character-'
 

The DBCLOB function returns a graphic-string representation of:

The result of the function is a DBCLOB. If the first argument can be null, the result can be null; if the first argument is null, the result is the null value.

Character to DBCLOB

character-expression
An expression that returns a value that is a built-in character-string data type. It cannot be CHAR or VARCHAR bit data. If the expression is an empty string or the EBCDIC string X'0E0F', the result is an empty string.
length
An integer constant that specifies the length attribute for the resulting varying length character string. The value must be between 1 and 1 073 741 823.

If the second argument is not specified or DEFAULT is specified:

The actual length of the result is the minimum of the length attribute of the result and the actual length of character-expression. If the length of the character-expression is greater than the length attribute of the result, truncation is performed. A warning (SQLSTATE 01004) is returned unless the truncated characters were all blanks.

integer
An integer constant that specifies the CCSID for the resulting varying-length graphic string. It must be a DBCS, UTF-16, or UCS-2 CCSID. The CCSID cannot be 65535.

In the following rules, S denotes one of the following:

If the third argument is not specified and the first argument is character, then the CCSID of the result is determined by a mixed CCSID. Let M denote that mixed CCSID. M is determined as follows:

The following table summarizes the result CCSID based on M.

M Result CCSID Description DBCS Substitution Character
930 300 Japanese EBCDIC X'FEFE'
933 834 Korean EBCDIC X'FEFE'
935 837 S-Chinese EBCDIC X'FEFE'
937 835 T-Chinese EBCDIC X'FEFE'
939 300 Japanese EBCDIC X'FEFE'
5026 4396 Japanese EBCDIC X'FEFE'
5035 4396 Japanese EBCDIC X'FEFE'

If the result is DBCS-graphic data, the equivalence of SBCS and DBCS characters depends on M. Regardless of the CCSID, every double-byte code point in the argument is considered a DBCS character, and every single-byte code point in the argument is considered an SBCS character with the exception of the EBCDIC mixed data shift codes X'0E' and X'0F'.

If the result is Unicode graphic data, each character of the argument determines a character of the result. The nth character of the result is the UTF-16 or UCS-2 equivalent of the nth character of the argument.

Graphic to DBCLOB

graphic-expression
An expression that returns a value that is a built-in graphic-string data type.
length
An integer constant that specifies the length attribute for the resulting varying length character string. The value must be between 1 and 1 073 741 823.

If the second argument is not specified or DEFAULT is specified:

The actual length of the result is the minimum of the length attribute of the result and the actual length of graphic-expression. If the length of the graphic-expression is greater than the length attribute of the result, truncation is performed. A warning (SQLSTATE 01004) is returned unless the truncated characters were all blanks.

integer
An integer constant that specifies the CCSID for the resulting varying-length graphic string. It must be a DBCS, UTF-16, or UCS-2 CCSID. The CCSID cannot be 65535.

In the following rules, S denotes one of the following:

If the third argument is not specified, then the CCSID of the result is the same as the CCSID of the first argument.

Integer to DBCLOB

integer-expression
An expression that returns a value that is a built-in integer data type (either SMALLINT, INTEGER, or BIGINT).

The result is a varying-length graphic string of the argument in the form of an SQL integer constant. The result consists of n characters that are the significant digits that represent the value of the argument with a preceding minus sign if the argument is negative. The result is left justified.

The actual length of the result is the smallest number of characters that can be used to represent the value of the argument. Leading zeroes are not included. If the argument is negative, the first character of the result is a minus sign. Otherwise, the first character is a digit.

The CCSID of the result is 1200 (UTF-16).

Decimal to DBCLOB

decimal-expression
An expression that returns a value that is a built-in decimal data type (either DECIMAL or NUMERIC). If a different precision and scale is desired, the DECIMAL scalar function can be used to make the change.
decimal-character
Specifies the single-byte character constant that is used to delimit the decimal digits in the result character string. The character must be a period or comma. If the second argument is not specified, the decimal point is the default decimal point. For more information, see Decimal point.

The result is a varying-length graphic string representation of the argument. The result includes a decimal character and up to p digits, where p is the precision of the decimal-expression with a preceding minus sign if the argument is negative. Leading zeros are not returned. Trailing zeros are returned.

The length attribute of the result is 2+p where p is the precision of the decimal-expression. The actual length of the result is the smallest number of characters that can be used to represent the result, except that trailing characters are included. Leading zeros are not included. If the argument is negative, the result begins with a minus sign. Otherwise, the result begins with a digit.

The CCSID of the result is 1200 (UTF-16).

Floating-point to DBCLOB

floating-point expression
An expression that returns a value that is a built-in floating-point data type (DOUBLE or REAL).
decimal-character
Specifies the single-byte character constant that is used to delimit the decimal digits in the result character string. The character must be a period or comma. If the second argument is not specified, the decimal point is the default decimal point. For more information, see Decimal point.

The result is a varying-length graphic string representation of the argument in the form of a floating-point constant.

The length attribute of the result is 24. The actual length of the result is the smallest number of characters that can represent the value of the argument such that the mantissa consists of a single digit other than zero followed by the decimal-character and a sequence of digits. If the argument is negative, the first character of the result is a minus sign; otherwise, the first character is a digit. If the argument is zero, the result is 0E0.

The CCSID of the result is 1200 (UTF-16).

Note

Syntax alternatives: When the length attribute is specified, the CAST specification should be used for maximal portability. For more information, see CAST specification.

Example