Subject | Re: [IBO] Common Table Expressions |
---|---|
Author | Minoru Yoshida |
Post date | 2009-04-14T05:19:57Z |
Hi,
Stefan Heymann wrote:
SQL.Clear;
SQLSelect.add('select lvl, name, dept_id');
SQLFrom.add('from dept_tree');
SQLSelect.insert(0.'with recursive dept_tree as (select...from depts ... union
all select...)');
Keylinks.text := 'dept_tree.dept_id=depts.dept_id';//dept_id is unique key
It works fine. but i have another ploblem at getting the RecordCount.
SQL trace:
--
Regards,
Minoru
Stefan Heymann <lists@...>
Sun, 12 Apr 2009 08:37:13 +0200 wrote:
Stefan Heymann wrote:
>In IBO 4.8.7, the IsSelectSql method does not recognize it as a SELECTI got the same messages and tried the workaround case as bellow.
>statement. And I get an error message:
> Invalid KeyLinks Entry: DEPT_TREE.RDB$DB_KEY
SQL.Clear;
SQLSelect.add('select lvl, name, dept_id');
SQLFrom.add('from dept_tree');
SQLSelect.insert(0.'with recursive dept_tree as (select...from depts ... union
all select...)');
Keylinks.text := 'dept_tree.dept_id=depts.dept_id';//dept_id is unique key
It works fine. but i have another ploblem at getting the RecordCount.
SQL trace:
>SELECT COUNT( * )I want to officially support the CTE in V4.8.7...
>From dept_tree
>FIELDS = [ Version 1 SQLd 1 SQLn 1
> < SQLType: 496 SQLLen: 4 > = -1 ]
>ERRCODE = 335544569
--
Regards,
Minoru
Stefan Heymann <lists@...>
Sun, 12 Apr 2009 08:37:13 +0200 wrote:
>Hi,
>
>this is a valid Firebird 2.1 Common Table Expression:
>
> with recursive
> dept_tree as (
> select dept_id, name, 0 as lvl
> from depts where parent_dept_id is null
>
> union all
>
> select d.dept_id, d.name, h.lvl + 1
> from depts d
> join dept_tree h
> on d.parent_dept_id = h.dept_id
> )
> select lvl, name, dept_id from dept_tree
>
>In IBO 4.8.7, the IsSelectSql method does not recognize it as a SELECT
>statement. And I get an error message:
>
> Invalid KeyLinks Entry: DEPT_TREE.RDB$DB_KEY
>
>What can I do?
>
>
>Best Regards
>
>Stefan Heymann