|
-
With MINUS, UNION and INTERSECT you can only use order by clause in two ways:
- by positional notation, like ".... ORDER BY 1"
- by listing the column name or an alias from the selected column list. So if you use UPPER(region_name) in ORDER BY, then you must also include this expression in the select list, assign it an alias and use that alias in your ORDER BY, eg:
select region_name,region_id, UPPER(region_name) upper_name
from region
where region_id <> p_selectedRegionId
and rank is null
and region_type = 'Global'
MINUS
select a.region_name,a.region_id, UPPER(region_name) upper_name
from region a, regionhierarchy b
where b.region_child_id=a.region_id
and b.region_parent_id = p_selectedRegionId
and a.rank is null
and region_type = 'Global'
order by upper_name;
If you don't want that UPPER() expression in your select list, you can change your cursor to something like:
SELECT region_name,region_id FROM
(
select region_name,region_id
from region
where region_id <> p_selectedRegionId
and rank is null
and region_type = 'Global'
MINUS
select a.region_name,a.region_id
from region a, regionhierarchy b
where b.region_child_id=a.region_id
and b.region_parent_id = p_selectedRegionId
and a.rank is null
and region_type = 'Global'
)
order by upper(region_name);
Jurij Modic
ASCII a stupid question, get a stupid ANSI
24 hours in a day .... 24 beer in a case .... coincidence?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|