Subject Re: [IBO] TIBOQuery problem
Author Helen Borrie
At 06:49 AM 5/08/2004 +0000, you wrote:
>I am in a Delphi 5 using Firebird 1.0 environment.
>
>I build a sql query that has a UNION statement. When I ran it using
>TIBOQuery in a smaller size of database, the result set has no
>problem.
>
>If I ran it against a much bigger scale (expecting a return of 18000
>records) of database, an exception raise: ISC Error code 335544569:
>invalid SQL command, count column list & variable list do not match.
>
>I ran the SQL query separatly without the Union, it worked ok.
>
>Is there a limit in TIBOQuery?

"Limit" doesn't come into it. The error code is a DSQL error, i.e. you
have some invalid syntax in the SQL statement. The error text you provided
here doesn't match any error string that IBO or Firebird generates, so it
would help if you could provide the actual error text you are seeing.

>Please help!

Possible syntax errors:
You might have a WHERE clause in the wrong place. In UNION queries you can
have WHERE clauses in the individual queries that form the set, but you
can't have a single WHERE clause for the whole set.

You might have an invalid ORDER BY clause. With ORDER BY, the rule is
reversed. You can't have ORDER BY in the individual queries that form the
set, but you can have a single ORDER BY following the last query. This
ORDER BY must refer to the columns by degree number (position, counting
from left to right).

You might have different numbers of columns in the individual queries, or
the data types of corresponding columns don't match.

Whatever....I suggest that you try out your UNION query in ib_sql or isql,
to see whether you can get more accurate information about the SQL syntax
error that is causing the exception.

Helen