发行说明


42.4 Data Type Information

42.4.1 Promotion of Data Types

在本节中,表 5 显示每个数据类型的优先权列表。请注意:

  1. 对于 Unicode 数据库,下列各项被认为是数据类型:
  2. 在 Unicode 数据库中,可以创建这样的函数:函数签名中的唯一区别在于等效的 CHAR 和 GRAPHIC 数据类型之间的区别。例如,foo(CHAR(8)) and foo(GRAPHIC(8))。 我们强烈建议您不要定义这样的重复函数,因为迁移到未来的发行版时将要求在继续迁移之前删除其中一个函数。

    若确实存在这样的重复函数,则选择调用哪个函数是由两遍算法来确定的。第一遍尝试使用用于解析非 Unicode 数据库中的函数的算法来查找匹配项。若找不到匹配项,则会根据 CHAR 和 GRAPHIC 字符串的以列提升优先权来执行第二遍算法:

    GRAPHIC-->CHAR-->VARGRAPHIC-->VARCHAR-->LONG VARGRAPHIC-->LONG VARCHAR-->DBCLOB-->CLOB
    

42.4.2 Casting between Data Types

以下条目已经添加至列表,并指出“涉及单值类型的下列强制转型是受支持的”:

以下是对“Table 6. Supported Casts between Built-in Data Types”的更新。只包括了该表中受影响的行。

表 17. Supported Casts between Built-in Data Types

Target Data Type >
 
 
 
 
 
 
Source Data Type V
CH
A
R
V
A
R
CH
A
R
L
O
N
G
V
A
R
CH
A
R
CL
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
CL
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.

42.4.3 Assignments and Comparisons

涉及到字符和图形数据的指定和比较仅当其中一个字符串为文字时才受支持。对于函数解析,图形文字和字符文字都将与字符和图形函数参数相匹配。

以下是对“Table 7. Data Type Compatibility for Assignments and Comparisons”的更新。仅包括受影响的表行和新脚注 6:

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.

42.4.3.1 String Assignments

Storage Assignment

这一小节的最后一段修改为如下所示:

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

这一小节的第三段修改为如下所示:

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

已经将下图添加至这一小节的结尾:

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

这一小节的第一段已修改为如下所示:

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.

42.4.3.2 String Comparisons

Conversion Rules for Comparison

这一小节已修改为如下所示:

When two strings are compared, one of the strings is first converted, if necessary, to the encoding scheme and code page of the other string. For details, see the "Rules for String Conversions" section of "Chapter 3. Language Elements" in the SQL Reference.

42.4.4 Rules for Result Data Types

42.4.4.1 Character and Graphic Strings in a Unicode Database

这是插入到“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)

42.4.5 Rules for String Conversions

第三点已添加至本节的以下列表:

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.

42.4.6 Expressions

已经添加了下列内容:

In a Unicode database, an expression that accepts a character or graphic string will accept any string types for which conversion is supported.

42.4.6.1 With the Concatenation Operator

已将以下内容添加至这一小节的末尾:

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.

42.4.7 Predicates

以下条目已添加至由语句“The following rules apply to all types of predicates”所指示的列表:


[ 页的顶部 | 上一页 | 下一页 | 目录 | 索引 ]