Just curios, given tables:
[lelle@[EMAIL PROTECTED]
share]$ db2 "create table A (c1 char(2) not null)"
DB20000I The SQL command completed successfully.
[lelle@[EMAIL PROTECTED]
share]$ db2 "create table B (c1 char(2) not null)"
DB20000I The SQL command completed successfully.
why is the following illegal:
[lelle@[EMAIL PROTECTED]
share]$ db2 "select c1 from A union select c1 from B
order by ucase(c1)"
SQL0214N An expression in the ORDER BY clause in the following
position, or
starting with "UCASE..." in the "ORDER BY" clause is not valid.
Reason code =
"1". SQLSTATE=42822
but:
[lelle@[EMAIL PROTECTED]
share]$ db2 "select c1 from (select c1 from A union
select c1 from B) X order by ucase(c1)"
is ok? The only reason I can think of is that X is guaranteed to be
evaluated before order by, but I'm not sure that this is true. Anyone
care to fill in the details?
/Lennart