|In this section table 5 shows the precedence list for each data type. Please |note: |
|If such duplicate functions do exist, the choice of which |one to invoke is determined by a two pass algorithm. The first pass attempts |to find a match using the same algorithm as is used for resolving functions |in a non-Unicode database. If no match is found, then a second pass will be |done taking into account the following promotion precedence for CHAR and GRAPHIC |strings:
|GRAPHIC-->CHAR-->VARGRAPHIC-->VARCHAR-->LONG VARGRAPHIC-->LONG VARCHAR-->DBCLOB-->CLOB
||The following entry has been added to the list introduced as: "The following |casts involving distinct types are supported": |
|The following are updates to Table 6. Supported Casts
|between Built-in Data Types. Only the affected rows of the table are
|included.
|
|Table 31. Supported Casts between Built-in Data Types
Target Data Type > Source Data Type V |
C H A R |
V A R C H A R |
L O N G V A R C H A R |
C L O B |
G R A P H I C |
V A R G R A P H I C |
L O N G V A R G R A P H I C |
D B C L O B |
---|---|---|---|---|---|---|---|---|
CHAR | Y | Y | Y | Y | Y1 | Y1 | - | - |
VARCHAR | Y | Y | Y | Y | Y1 | Y1 | - | - |
LONGVARCHAR | Y | Y | Y | Y | - | - | Y1 | Y1 |
CLOB | Y | Y | Y | Y | - | - | - | Y1 |
GRAPHIC | Y1 | Y1 | - | - | Y | Y | Y | Y |
VARGRAPHIC | Y1 | Y1 | - | - | Y | Y | Y | Y |
LONGVARGRAPHIC | - | - | Y1 | Y1 | Y | Y | Y | Y |
DBCLOB | - | - | - | Y1 | Y | Y | Y | Y |
|Assignments and comparisons involving both character and graphic |data are only supported when one of the strings is a literal. For function |resolution, graphic literals and character literals will both match character |and graphic function parameters.
|The following are updates to Table 7. Data Type Compatibility
|for Assignments and Comparisons. Only the affected rows of the table,
|and the new footnote 6, are included:
|
Operands | Binary Integer | Decimal Number | Floating Point | Character String | Graphic String | Date | Time | Time- stamp | Binary String | UDT |
---|---|---|---|---|---|---|---|---|---|---|
Character String | No | No | No | Yes | Yes 6 | 1 | 1 | 1 | No 3 | 2 |
Graphic String | No | No | No | Yes 6 | Yes | No | No | No | No | 2 |
|
|Storage Assignment
|The last paragraph of this sub-section is modified as follows:
|When a string is assigned to a fixed-length column and the length of the |string is less than the length attribute of the target, the string is padded |to the right with the necessary number of single-byte, double-byte, or UCS-22 blanks. The pad character is always a blank even |for columns defined with the FOR BIT DATA attribute.
|Retrieval Assignment
|The third paragraph of this sub-section is modified as follows:
|When a character string is assigned to a fixed-length variable and the |length of the string is less than the length attribute of the target, the |string is padded to the right with the necessary number of single-byte, double-byte, |or UCS-22 blanks. The pad character is always |a blank even for strings defined with the FOR BIT DATA attribute. |
|Conversion Rules for String Assignments
|The following paragraph has been added to the end of this sub-section:
|For Unicode databases, character strings can be assigned to a graphic column, |and graphic strings can be assigned to a character column.
|DBCS Considerations for Graphic String Assignments
|The first paragraph of this sub-section has been modified as follows:
|Graphic string assignments are processed in a manner analogous to that |for character strings. For non-Unicode databases, graphic string data types |are compatible only with other graphic string data types, and never with |numeric, character string, or datetime data types. For Unicode databases, |graphic string data types are compatible with character string data types.
|
|Conversion Rules for Comparison
|This sub-section has been modified as follows:
|When two strings are compared, one of the strings is first converted, if |necessary, to the encoding scheme and/or code page of the other string. For |details, see the "Rules for String Conversions" section of Chapter 3 Language Elements in the SQL Reference.
|This is a new sub-section inserted after the sub-section "Graphic Strings".
|In a Unicode database, character strings and graphic strings are compatible.
|
If one operand is... | And the other operand is... | The data type of the result is... |
---|---|---|
GRAPHIC(x) | CHAR(y) or GRAPHIC(y) | GRAPHIC(z) where z = max(x,y) |
VARGRAPHIC(x) | CHAR(y) or VARCHAR(y) | VARGRAPHIC(z) where z = max(x,y) |
VARCHAR(x) | GRAPHIC(y) or VARGRAPHIC | VARGRAPHIC(z) where z = max(x,y) |
LONG VARGRAPHIC | CHAR(y) or VARCHAR(y) or LONG VARCHAR | LONG VARGRAPHIC |
LONG VARCHAR | GRAPHIC(y) or VARGRAPHIC(y) | LONG VARGRAPHIC |
DBCLOB(x) | CHAR(y) or VARCHAR(y) or CLOB(y) | DBCLOB(z) where z = max(x,y) |
DBCLOB(x) | LONG VARCHAR | DBCLOB(z) where z = max(x,16350) |
CLOB(x) | GRAPHIC(y) or VARGRAPHIC(y) | DBCLOB(z) where z = max(x,y) |
CLOB(x) | LONG VARGRAPHIC | DBCLOB(z) where z = max(x,16350) |
|The third point has been added to the following list in this section:
|For each pair of code pages, the result is determined by the sequential |application of the following rules: |
|The following has been added:
|In a Unicode database, an expression that accepts a character or graphic |string will accept any string types for which conversion is supported.
|The following has been added to the end of this sub-section:
|In a Unicode database, concatenation involving both character string operands |and graphic string operands will first convert the character operands to graphic |operands. Note that in a non-Unicode database, concatenation cannot involve |both character and graphic operands.
|The following entry has been added to the list introduced by the sentence: |"The following rules apply to all types of predicates":
|
|The following sentence has been added to the end of this section:
|In a Unicode database, all scalar functions that accept a character |or graphic string will accept any string types for which conversion is supported.