0

Informix データベースで次のクエリを実行すると、データベースは一般的な構文エラーを報告します (問題の原因に関する指示はありません)。同じクエリは、CUBRID または Oracle データベースで完全に実行され、どちらも次のCONNECT BY構文もサポートしています。

select 
  lower(connect_by_root "t_directory"."name"), 
  connect_by_isleaf, 
  connect_by_iscycle, 
  substr(
    sys_connect_by_path(lower("t_directory"."name"), '/'), 
    2) "dir"
from "t_directory"
start with "t_directory"."parent_id" is null
connect by nocycle prior "t_directory"."id" = "t_directory"."parent_id"
order siblings by lower("t_directory"."name") asc

私が使用しているデータベースは、Windows 上の Informix 12.10 の Developer Edition です。次の接続 URL を使用して JDBC ドライバーからクエリを実行しています (テーブル識別子を引用できるようにするため)。

jdbc:informix-sqli://localhost:9092/test:INFORMIXSERVER=ol_informix;DELIMIDENT=y
4

1 に答える 1

0

ここでの正確な問題は、prior引用されたテーブル識別子を受け入れないという事実ですが、引用された列識別子は問題ないようです。このクエリは完全に正常に実行されます。

select 
  lower(connect_by_root "t_directory"."name"), 
  connect_by_isleaf, 
  connect_by_iscycle, 
  substr(
    sys_connect_by_path(lower("t_directory"."name"), '/'), 
    2) "dir"
from "t_directory"
start with "t_directory"."parent_id" is null
connect by nocycle prior t_directory."id" = "t_directory"."parent_id"
order siblings by lower("t_directory"."name") asc

...違いは次のとおりです。

-- Bad:
connect by nocycle prior "t_directory"."id" = "t_directory"."parent_id"

-- Good:
connect by nocycle prior t_directory."id" = "t_directory"."parent_id"
于 2014-07-30T12:07:39.793 に答える