Consultor Eletrônico



Kbase P32298: Error# 7645 with ORDER BY clause and UNION set operator.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   7/14/2006
Status: Verified

FACT(s) (Environment):

Progress 9.1x
OpenEdge 10.0A

SYMPTOM(s):

Executing a SELECT Statement that makes use of the ORDER BY clause and the UNION set operator.

Using SQL-92

=== SQL Exception 1 ===
SQLState=HY000
ErrorCode=-20027
[JDBC Progress Driver]:Bad field specification in order by clause (7645)

CAUSE:

This is a known issue being investigated by Development

FIX:

- Remove the "ORDER BY" clause from the query.

or

- Change the "ORDER BY Field" statement by "ORDER BY FieldNumber", where FieldNumber is the position of the field in the first SELECT statement.

For example, the following query:
SELECT c1.salesrep FROM pub.customer c1
UNION
SELECT o1.salesrep FROM pub.order o1
ORDER BY salesrep;

will become:
SELECT c1.salesrep FROM pub.customer c1
UNION
SELECT o1.salesrep FROM pub.order o1
ORDER BY 1;