CLOB
The CLOB function returns a CLOB representation of a string.
Character to CLOB:
>>-CLOB(character-expression-+------------------------------------+-)->< '-,--integer--+--------------------+-' '-,--+-CODEUNITS16-+-' +-CODEUNITS32-+ '-OCTETS------'
Graphic to CLOB:
>>-CLOB(graphic-expression-+------------------------------------+-)->< '-,--integer--+--------------------+-' '-,--+-CODEUNITS16-+-' '-CODEUNITS32-'
The schema is SYSIBM.
Character to CLOB
- character-expression
- An expression that returns a value of a character string. If character-expression is bit data, an error occurs.
- integer
- An integer constant that specifies the length attribute of the
resulting CLOB data type. The value must be between 1 and the
maximum length of a CLOB, expressed in the units that are either implicitly
or explicitly specified.
If you do not specify integer and character-expression is an empty string constant, the length attribute of the result is 1, and the result is an empty string. Otherwise, the length attribute of the result is the same as the length attribute of character-expression.
If CODEUNITS16 or CODEUNITS32 is specified, see Determining the length attribute of the final result for information on how to calculate the length attribute of the result string.
- CODEUNITS16, CODEUNITS32, or OCTETS
- Specifies the unit that is used to express integer.
- CODEUNITS16
- Specifies that integer is expressed in terms of 16-bit UTF-16 code units.
- CODEUNITS32
- Specifies that integer is expressed in terms of 32-bit UTF-32 code units.
- OCTETS
- Specifies that integer is expressed in terms of bytes.
For more information about CODEUNITS16, CODEUNITS32, and OCTETS, see String unit specifications.
The result of the function is a CLOB.
The result can be null; if the first argument is null, the result is the null value.
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 character-expression is greater than the length specified, the result is truncated. Unless all of the truncated characters are blanks, a warning is returned.
The CCSID of the result is the same as the CCSID of character-expression.
Graphic to CLOB
- graphic-expression
- An expression that returns a value of a graphic string.
- integer
- An integer constant that specifies the length attribute of the
resulting CLOB data type. The value must be between 1 and the
maximum length of a CLOB, expressed in the units that are either implicitly
or explicitly specified.
If you do not specify integer and graphic-expression is an empty string constant, the length attribute of the result is 1, and the result is an empty string. Otherwise, the length attribute of the result is (3 * length(graphic-expression)).
If CODEUNITS16 or CODEUNITS32 is specified, see Determining the length attribute of the final result for information on how to calculate the length attribute of the result string.
- CODEUNITS16 or CODEUNITS32
- Specifies the unit that is used to express integer.
- CODEUNITS16
- Specifies that integer is expressed in terms of 16-bit UTF-16 code units.
- CODEUNITS32
- Specifies that integer is expressed in terms of 32-bit UTF-32 code units.
For more information about CODEUNITS16 and CODEUNITS32, see String unit specifications.
The result of the function is a CLOB.
The result can be null; if the first argument is null, the result is the null value.
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 graphic-expression is greater than the length specified, the result is truncated. Unless all of the truncated characters are blanks, a warning is returned.
The CCSID of the result is the character mixed CCSID that corresponds to the graphic CCSID of graphic-expression.
SELECT CLOB('This is a CLOB')
FROM SYSIBM.SYSDUMMY1;
Function ... Returns ...
CLOB(FIRSTNME,3,CODEUNITS32) 'Jür' -- x'4AC3BC72'
CLOB(FIRSTNME,3,CODEUNITS16) 'Jür' -- x'4AC3BC72'
CLOB(FIRSTNME,3,OCTETS) 'Jü' -- x'4AC3BC'