Retrieving data from the Db2 catalog
Beginning in DB2® version 8, most of the Db2 catalog data is stored in UTF-8. However, when you query the catalog data, Db2 converts the data to the application encoding scheme.
About this task
Having the catalog in Unicode enables your SQL statements to use names and literals that contain characters that are not included in the subsystem EBCDIC CCSID.
Although most of the catalog is stored in UTF-8, several catalog tables are exceptions. SYSIBM.SYSCOPY in DSNDB06.SYSTSCPY is not stored in UTF-8. Also the non-Unicode SYSIBM.SYSDUMMYx tables are not stored in UTF-8.
You can select data from the catalog regardless of the application encoding scheme.
Procedure
To retrieve data from the Db2 catalog, perform all of the following actions:
- Ensure that you anticipate the sequence of the query result. Because the Db2 catalog is in Unicode UTF-8 , queries against the catalog return the data according to the Unicode sorting sequence. In Unicode, numeric characters are sorted before alphabetic characters.
- If you are using application host variables to store the
results of any catalog string column values, ensure that these variables
are large enough to hold those values. Many string columns in the Db2 catalog are VARCHAR(128).