A CAST function can be used to convert one data type to another in DB2.
For example:
OutputSELECT 100, LPAD(CAST(100 as VARCHAR(5)), 5, 'X') AS CONVERTED FROM SYSIBM.SYSDUMMY1;
1 | CONVERTED |
100 | XX100 |
In the example the LPAD function is used to show that the converted value is of type varchar and not integer.
REFERENCES:
Casting between data types
No comments:
Post a Comment