Discussions
Why I get ORA-00904 when I use "select * union all order by <column_name>?
Oracle: 11.2.0.4 AIX: 6.1
Please can you explain me, why I get
ORA-00904: "F1": invalid identifier
when I do following select:
select * from t1
union all
select * from t1_copy
order by f1;
When I use a number in "order by" then the query runs fine:
select * from t1
union all
select * from t1_copy
order by 1;
The query also runs fine when I use a column_list instead of "*":
select f1 from t1
union all
select f1 from t1_copy
order by f1;
Here a small test case:
create table t1 (f1 number);
create table t1_copy (f1 number);
insert into t1 values (1);
0