在变量名称上使用@ [英] Using @ on Variable Names

查看:196
本文介绍了在变量名称上使用@的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Googling我发现这个DB2函数声明:

Googling I've found this DB2 Function declaration:

CREATE FUNCTION QGPL.SPLIT ( 
@Data     VARCHAR(32000), 
@Delimiter VARCHAR(5)
)

什么意思@符号之前的变量名称?

Whats means @ symbol before the Variable Name?

问候,

Pedro

推荐答案

@字符只是SQL标识符[variable name]的第一个字符,命名为用户定义函数(UDF)的参数定义的参数;稍微重新格式化[因为乍一看,我认为修改可能会使符号看起来更明显地成为名称的一部分,尽管现在我认为可能不是]:

The @ character is simply the first character of the SQL identifier [variable name] naming the parameter defined for the arguments of the User Defined Function (UDF); slightly reformatted [because at first glance I thought that revision might make the at-symbols appear more conspicuously to be part of the name, though now I think probably not]:

 CREATE FUNCTION QGPL.SPLIT
 ( @Data      VARCHAR(32000)
 , @Delimiter VARCHAR(5)
 ) returns ...

简单来说,非常不鼓励在标识符中使用@字符;使用这种变体字符,尽管在标准对象命名中支持 ,它们可能会导致很大的痛苦和困难,包括一些不可逾越的:

Put simply, the use of the @ character in an identifier is highly discouraged; the use of such variant characters, although supported in standard object naming, they can cause great pains and difficulties, including some that are insurmountable:

http:// www。 ibm.com/support/knowledgecenter/api/content/ssw_ibm_i_71/db2/rbafzch2iden.htm


标识符


标识符是用于形成名称的标记。 SQL语句中的标识符是SQL标识符,系统标识符或主机标识符。
注意:$,@,#和所有其他变体字符不应用于标识符,因为用于表示它们的代码点取决于包含它们的字符串的CCSID。如果使用它们,可能会发生不可预测的结果。 [...]

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

[Edit-addendum 17May2015]

http://www.ibm.com/support/knowledgecenter/api/content/nl/en-us/SSEPGG_10.5.0/com.ibm.db2.luw .admin.dbobj.doc / doc / c0004625.html


多国语言环境中的命名规则


可用于数据库名称的基本字符集由单字节大写和小写拉丁字母(A ... Z,a ... z),阿拉伯数字( 0 ... 9)和下划线字符(_)。



此列表增加了三个特殊字符(#,@和$),以提供与主机数据库产品的兼容性。在多国语言环境中使用特殊字符#,@和$,因为它们不包含在多国语言主机(EBCDIC)不变字符集中。根据正在使用的代码页,也可以使用扩展字符集的字符。如果在多个代码页环境中使用数据库,则必须确保所有代码页都支持您计划使用的扩展字符集中的任何元素。
[...]

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]

这篇关于在变量名称上使用@的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆