Subject RE: [firebird-support] ORDER BY invalid column
Author Rick Debay
Thanks that works, but I'm also looking for confirmation that my
previous query was valid SQL, so I can submit a bug report.

-----Original Message-----
[] On Behalf Of Alexandre Benson
Sent: Friday, December 16, 2005 1:18 PM
Subject: Re: [firebird-support] ORDER BY invalid column

Rick Debay wrote:

>I was running a one-off query in order to do some inventory analysis,
>and got this error. FB will only allow me to choose columns returned
>from the table in this query, not generated columns (ORDER BY 9 also
>fails). Which is strange, as I know I've used generated columns in
>other queries.
>Dynamic SQL Error SQL error code = -104 Invalid column position used in

>the ORDER BY clause
> p.*,
> (p.decimalqty - p.order_qty - p.po_qty - p.bo_qty) outstanding,
> (select first 1 d.labelname from mddb_drug d where d.PRODUCTID/100 =
>p.ndc9) <== column 10
> P_RPL_NDC9_2( '01J' ) p
> (p.decimalqty - p.order_qty - p.po_qty - p.bo_qty) > 0 order by
> 10

Name each column from Procedure P_RPL_NDC9_2 (P) instead of using p.*

see you !

Alexandre Benson Smith
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil


Visit and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !

Also search the knowledgebases at


Yahoo! Groups Links