Apache Derby # 符号上出现词法错误?
我正在以编程方式在 DB2 服务器和 Apache Derby (JavaDB) 服务器之间传输数据。
DB2 服务器有许多表,其列名称中包含井号 (#) 字符。但是,当尝试在 Derby 中创建表时:
CREATE TABLE LIBNAME.TABNAME
(COL# decimal(3,0),
REC# decimal(5,0),
DESC char(30,0),
SDSC char(10,0));
我收到以下错误:
错误 42X02:第 1 行第 38 列出现词法错误。遇到:“#”(35),之后:“”
Derby 参考手册 没有帮助;错误代码 42X02 的给出的解释很简单
从 Derby 的列名称中删除井号然后将其添加回 DB2 是一个简单的任务,但我想避免如果可以的话。
有谁知道 Derby 是否根本不允许使用 # 字符(为什么?)或者我是否做错了什么......
I'm programmatically transferring data between a DB2 server and an Apache Derby (JavaDB) server.
The DB2 server has a number of tables with column names that include the pound sign (#) character. However, when trying to create tables in Derby:
CREATE TABLE LIBNAME.TABNAME
(COL# decimal(3,0),
REC# decimal(5,0),
DESC char(30,0),
SDSC char(10,0));
I get the following error:
ERROR 42X02: Lexical error at line 1, column 38. Encountered: "#" (35), after : ""
The Derby Reference Manual is no help; the given explanation for error code 42X02 is simply <value>
It's a simple task to remove the pound sign from the column names for Derby and then add it back for DB2, but I'd like to avoid it if I can.
Does anyone happen to know if Derby simply doesn't allow the # character (and why?) or if I'm doing something wrong...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据Derby参考手册(规则对于 SQL92 标识符):
因此,由于
#
,COL#
作为普通标识符似乎无效。"COL#"
作为分隔标识符可能是有效的,但我还没有对此进行测试。According to the Derby reference manual (Rules for SQL92 Identifiers):
So,
COL#
appears to be invalid as an ordinary identifier because of the#
."COL#"
would probably be valid as a delimited identifier, but I haven't tested this.