DbUnit HSQLDB - 模式名称无效:C

时间:2011-04-14 01:10:09

标签: oracle hsqldb dbunit

使用以下查询运行测试时,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;

以前有没有人经历过这个?如果“是”,那么修复是什么?

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

1 个答案:

答案 0 :(得分:6)

问题是非标准的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