DbUnit HSQLDB - 无效架构名称:C

发布于 2024-11-01 08:13:10 字数 463 浏览 7 评论 0原文

当使用以下查询运行测试时,HSQLDB 将表别名误认为是架构。

SELECT c.country_ml2country as CTRY_PK, c.name as CTRY_NAME,
l.name as LANGUAGE_NAME, l.code as LANGUAGE_CODE
FROM country_ml as c, language as l
WHERE c.language(+) = l.id and c.country_ml2country(+) = ?
ORDER BY l.name ASC;

以前有人经历过吗?如果“是”,那么解决方法是什么?

请注意,如果我将 FROMcountry_ml as c 更改为 FROMcountry_ml as bob,则错误消息会相应更改为invalid schema name: BOB

When running a test with the following query, HSQLDB mistakes the table alias as a schema.

SELECT c.country_ml2country as CTRY_PK, c.name as CTRY_NAME,
l.name as LANGUAGE_NAME, l.code as LANGUAGE_CODE
FROM country_ml as c, language as l
WHERE c.language(+) = l.id and c.country_ml2country(+) = ?
ORDER BY l.name ASC;

Has anyone experienced this before? If "yes", then what is the fix?

Note that if I change FROM country_ml as c to FROM country_ml as bob, then the error message changes accordingly to invalid schema name: BOB.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

混吃等死 2024-11-08 08:13:10

问题在于非标准 Oracle 风格的 OUTER JOIN 语法,该语法是 Oracle 特有的,其他 SQL 方言不支持。

WHERE c.language(+) = l.id and c.country_ml2country(+) = ?

您应该使用以下标准语法,Oracle 也支持该语法:

SELECT c.country_ml2country as CTRY_PK, c.name as CTRY_NAME,
l.name as LANGUAGE_NAME, l.code as LANGUAGE_CODE
FROM country_ml as c RIGHT OUTER JOIN language as l
ON c.language = l.id and c.country_ml2country = ?
ORDER BY l.name ASC

The problem is the non-standard Oracle-style OUTER JOIN syntax, which is specific to Oracle and not supported by other SQL dialects.

WHERE c.language(+) = l.id and c.country_ml2country(+) = ?

You should use instead the following standard syntax, which Oracle also supports:

SELECT c.country_ml2country as CTRY_PK, c.name as CTRY_NAME,
l.name as LANGUAGE_NAME, l.code as LANGUAGE_CODE
FROM country_ml as c RIGHT OUTER JOIN language as l
ON c.language = l.id and c.country_ml2country = ?
ORDER BY l.name ASC
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文