Subject Sql query help
Author Mahesh Ishwar
Hello All,
May be this is easy, but I'm not able to figure it out, as to to how this can be solved.
I've a select procedure, which returns me a resultset

create procedure...
begin
for select col1, col2 from table1 where col1=<const> order by col1
do
suspend;
end

This is working fine. But if a union query instead of a single query is used, the stored procedure gives compilation error
'invalid ORDER BY clause' or 'Token unknown union'

create procedure...
begin
for
select col1, col2 from table1 where col1=<const> order by col1
union
select col1, col2 from table1 where col1=<const> order by col1
do
suspend;
end

If I remove the order by clause, it works fine. What I want, is that the total resulset should be sorted.
Can someone help me out to figure this?

Thanx.
Mahesh.



---------------------------------
Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download Messenger Now

[Non-text portions of this message have been removed]