The CHAR_MAP precompiler command line option is available to specify the default mapping of char[n] and char host variables. Oracle maps them to CHARZ. CHARZ implements the ANSI Fixed Character format. Strings are fixed-length, blank-padded and null-terminated. VARCHAR2 values (including nulls) are always fixed-length and blank-padded. Table 5-1 shows the possible settings of CHAR_MAP:
Table 5-1 CHAR_MAP Settings | | |
| | |
CHAR_MAP Setting | Is Default for | Description |
VARCHAR2 | | All values (including null) are fixed-length blank-padded. |
CHARZ | DBMS=V7, DBMS=V8 | Fixed-length blank-padded, then null-terminated. Conforms to the ANSI Fixed Character type. |
STRING | New format | null-terminated. Conforms to ASCII format used in C programs. |
CHARF | Previously, only through VAR or TYPE declarations. | Fixed-length blank-padded. null is left unpadded |
The default mapping is CHAR_MAP=CHARZ, which was the case in previous versions of Pro*C/C++.
Use CHAR_MAP=VARCHAR2 instead of the old DBMS=V6_CHAR, which is obsolete.
Inline Usage of the CHAR_MAP Option