在变量名上使用@
Using @ on Variable Names
谷歌搜索我找到了这个 DB2 函数声明:
CREATE FUNCTION QGPL.SPLIT (
@Data VARCHAR(32000),
@Delimiter VARCHAR(5)
)
变量名前的@符号是什么意思?
此致,
佩德罗
@ 字符只是 SQL 标识符 [变量名] 的第一个字符,命名为用户定义函数 (UDF) 的参数定义的参数;稍微重新格式化 [因为乍一看我认为修订可能会使 at 符号更明显地成为名称的一部分,但现在我认为可能不会]:
CREATE FUNCTION QGPL.SPLIT
( @Data VARCHAR(32000)
, @Delimiter VARCHAR(5)
) returns ...
简而言之,非常不鼓励在标识符中使用@字符;使用这样的 variant 字符,虽然在标准对象命名中 支持 ,但它们会带来很大的痛苦和困难,包括一些无法克服的困难:
http://www.ibm.com/support/knowledgecenter/api/content/ssw_ibm_i_71/db2/rbafzch2iden.htm
Identifiers
An identifier is a token used to form a name. An identifier in an SQL statement is an SQL identifier, a system identifier, or a host identifier.
Note: $, @, #, and all other variant characters should not be used in identifiers because the code points used to represent them vary depending on the CCSID of the string in which they are contained. If they are used, unpredictable results may occur. [...]
[编辑-附录 2015 年 5 月 17 日]
Naming rules in a multiple national language environment
The basic character set that can be used in database names consists of the single-byte uppercase and lowercase Latin letters (A…Z, a…z), the Arabic numerals (0…9) and the underscore character (_).
This list is augmented with three special characters (#, @, and $) to provide compatibility with host database products. Use special characters #, @, and $ with care in a multiple national language environment because they are not included in the multiple national language host (EBCDIC) invariant character set. Characters from the extended character set can also be used, depending on the code page that is being used. If you are using the database in a multiple code page environment, you must ensure that all code pages support any elements from the extended character set you plan to use.
[...]
[/Edit-addendum 17May2015]
谷歌搜索我找到了这个 DB2 函数声明:
CREATE FUNCTION QGPL.SPLIT (
@Data VARCHAR(32000),
@Delimiter VARCHAR(5)
)
变量名前的@符号是什么意思?
此致,
佩德罗
@ 字符只是 SQL 标识符 [变量名] 的第一个字符,命名为用户定义函数 (UDF) 的参数定义的参数;稍微重新格式化 [因为乍一看我认为修订可能会使 at 符号更明显地成为名称的一部分,但现在我认为可能不会]:
CREATE FUNCTION QGPL.SPLIT
( @Data VARCHAR(32000)
, @Delimiter VARCHAR(5)
) returns ...
简而言之,非常不鼓励在标识符中使用@字符;使用这样的 variant 字符,虽然在标准对象命名中 支持 ,但它们会带来很大的痛苦和困难,包括一些无法克服的困难:
http://www.ibm.com/support/knowledgecenter/api/content/ssw_ibm_i_71/db2/rbafzch2iden.htm
Identifiers
An identifier is a token used to form a name. An identifier in an SQL statement is an SQL identifier, a system identifier, or a host identifier. Note: $, @, #, and all other variant characters should not be used in identifiers because the code points used to represent them vary depending on the CCSID of the string in which they are contained. If they are used, unpredictable results may occur. [...]
[编辑-附录 2015 年 5 月 17 日]
Naming rules in a multiple national language environment
The basic character set that can be used in database names consists of the single-byte uppercase and lowercase Latin letters (A…Z, a…z), the Arabic numerals (0…9) and the underscore character (_).
This list is augmented with three special characters (#, @, and $) to provide compatibility with host database products. Use special characters #, @, and $ with care in a multiple national language environment because they are not included in the multiple national language host (EBCDIC) invariant character set. Characters from the extended character set can also be used, depending on the code page that is being used. If you are using the database in a multiple code page environment, you must ensure that all code pages support any elements from the extended character set you plan to use. [...]
[/Edit-addendum 17May2015]