简体   繁体   English

“LABEL ON”语句中的 Unicode 字符 - AS400/DB2

[英]Unicode characters in “LABEL ON” statement - AS400/DB2

I would like to put a unicode character inside a "LABEL ON" statement in AS400.我想将 unicode 字符放在 AS400 中的“LABEL ON”语句中。 It gives me the following error:它给了我以下错误:

[Error Code: -104, SQL State: 42601] [SQL0104] Token UX'0171' was not valid. Valid tokens: <CHARSTRING>. Cause. . . . . : A syntax error was detected at token UX'0171'. Token UX'0171' is not a valid token. A partial list of valid tokens is <CHARSTRING>. This list assumes that the statement is correct up to the token. The error may be earlier in the statement, but the syntax of the statement appears to be valid up to this point. Recovery. . . : Do one or more of the following and try the request again: -- Verify the SQL statement in the area of the token UX'0171'. Correct the statement. The error could be a missing comma or quotation mark, it could be a misspelled word, or it could be related to the order of clauses. -- If the error token is <END-OF-STATEMENT>, correct the SQL statement because it does not end with a valid clause.

The statement is:声明是:

LABEL ON COLUMN TABLENAME.COLUMNNAME IS 'ű';

"ű" is a Hungarian double acute letter, Unicode is U+0171. “ű”是匈牙利双锐角字母,Unicode 是 U+0171。 It also throws an error on the other double acute letter "ő" (U+0151).它还会在另一个双锐角字母“ő”(U+0151)上引发错误。 It does not throw an error on less special characters, like single acute letters (áéíóúöü).它不会对不太特殊的字符抛出错误,例如单个锐音字母 (áéíóúöü)。

IBM page on "LABEL ON" statement has no specifics to character codes, it only mentions the length of the label. IBM 页面上的“LABEL ON”声明没有具体的字符代码,它只提到了 label 的长度。

I tried inserting text with this character in a random text column in the database and it had no problem insterting (though it had displaying, but that is less of a problem now).我尝试在数据库中的随机文本列中插入带有此字符的文本,并且插入没有问题(虽然它有显示,但现在问题不大了)。

I also read somewhere that the AS400 has many names, which makes it difficult to search for answers.我还在某处读到,AS400 有很多名称,这使得搜索答案变得困难。

Is there a way to make it possible to enter such special unicode characters inside a "LABEL ON" statement in AS400?有没有办法可以在 AS400 的“LABEL ON”语句中输入这种特殊的 unicode 字符?

The LABEL ON syntax for column labels is:列标签的 LABEL ON 语法为: LABEL ON 选定的语法树

According to the documentation of an SQL String Constant (found here ):根据 SQL 字符串常量的文档(在此处找到):

Character-string constants can contain mixed data.字符串常量可以包含混合数据。 If the job CCSID supports mixed data, a character-string constant is classified as mixed data if it includes a DBCS substring.如果作业 CCSID 支持混合数据,则如果字符串常量包含 DBCS substring,则将其分类为混合数据。 In all other cases, a character-string constant is classified as SBCS data.在所有其他情况下,字符串常量被归类为 SBCS 数据。

The CCSID assigned to the constant is the CCSID of the SQL statement text containing the constant unless the SQL statement is encoded in Unicode or a foreign encoding scheme (such as ASCII).分配给常量的 CCSID 是包含该常量的 SQL 语句文本的 CCSID,除非 SQL 语句以 Unicode 或外部编码方案编码。 In this case, the SQL statement text is converted from Unicode or the foreign encoding scheme to the default CCSID of the current server.在这种情况下,SQL 语句文本从 Unicode 或外部编码方案转换为当前服务器的默认 CCSID。 The CCSID assigned to the constant will be the default CCSID of the current server1.分配给常量的 CCSID 将是当前 server1 的默认 CCSID。

So string constants will be treated as DBCS or SBCS strings depending on your server's default CCSID (not necessarily 37).因此,字符串常量将被视为 DBCS 或 SBCS 字符串,具体取决于您服务器的默认 CCSID(不一定是 37)。 You can't insert Unicode into a label.您不能将 Unicode 插入 label。 If the character you want to use is in your default CCSID, then you can add it as a hex value if it isn't on your keyboard.如果您要使用的字符在您的默认 CCSID 中,那么您可以将其添加为十六进制值(如果它不在键盘上)。 Otherwise you are out of luck.否则你就不走运了。 Inserting data into the database is a different story.将数据插入数据库是另一回事。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM