版次注意事項


|40.2 SQL Reference(無中文版)

|40.2.1 Chapter 3 Language Elements

|40.2.1.1 Promotion of Data Types

|

|In this section table 5 shows the precedence list for each data type. Please |note: |

  1. |For a Unicode database, the following are considered to be equivalent |data types: |
  2. |In a Unicode database, it is possible to create functions where |the only difference in the function signature is between equivalent CHAR and |GRAPHIC data types, for example, foo(CHAR(8)) and foo(GRAPHIC(8)). We strongly |recommend that you do not define such duplicate functions since migration |to a future release will require one of them to be dropped before the migration |will proceed.

    |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
    |

|40.2.1.2 Casting Between Data Types

|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
|

|1
|Cast is only supported for Unicode databases. |

|40.2.1.3 Assignments and Comparisons

|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
|

|6
|Only supported for Unicode databases. |

|String Assignments
| | | |

|

|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. |

|2
|UCS-2 defines several SPACE characters with different properties. For |a Unicode database, the database manager always uses the ASCII SPACE at position |x'0020' as UCS-2 blank. For an EUC database, the IDEOGRAPHIC SPACE at position |x'3000' is used for padding GRAPHIC strings. |

|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.

|String Comparisons
|

|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.

|40.2.1.4 Rules for Result Data Types

|Character and Graphic Strings in a Unicode Database

|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)

|40.2.1.5 Rules for String Conversions

| | | |

|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: |

|

|1
|In a non-Unicode database, conversion between different encoding schemes |is not supported. |

|40.2.1.6 Expressions

|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.

|With the Concatenation Operator
| | | | | |

|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.

|40.2.1.7 Predicates

|The following entry has been added to the list introduced by the sentence: |"The following rules apply to all types of predicates":

|

|40.2.2 Chapter 4 Functions

|40.2.2.1 Scalar Functions

| |

|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.


[ 頁面頂端 | 前一頁 | 下一頁 | 目錄 | 索引 ]