H2 错误 SQLException: 90079 架构 ???未找到;将表别名解释为架构名称时?

问题描述 投票:0回答:1

我在 H2 数据库中使用表别名进行 SELECT 时遇到问题。

数据库是内存式的。它设置了

MODE=ORACLE
选项(作为 URL 的一部分)。

错误信息是:

SQLException: 90079 Schema "TERMIN" not found

选择是:

select crm.id, crm.surname, crm.firstname, grp.departm, grp.team
, termin.prev, termin.host, termin.final, termin.kenn
from client_member as crm, company_group as grp, base_process as termin
where crm.id = grp.crm_id and crm.crm_id = termin.crm_id (+)
and crm.pers_id not like 'B%'
and trunc(sysdate) between grp.date_from and nvl(grp.date_to, sysdate)
and ... ;

我做错了什么?为什么 H2 将表别名解释为模式标识符?

sql h2
1个回答
0
投票

(+)
符号必须替换为左连接以使其兼容。所以对于上面的例子

select 
  crm.id, crm.surname, crm.firstname, grp.departm, grp.team, 
  termin.prev, termin.host, termin.final, termin.kenn
from 
  client_member as crm, company_group as grp, base_process as termin
where 
  crm.id = grp.crm_id
  and crm.crm_id = termin.crm_id (+)
  and crm.pers_id not like 'B%'
  and trunc(sysdate) between grp.date_from
  and nvl(grp.date_to, sysdate)
  and ...;
© www.soinside.com 2019 - 2024. All rights reserved.