Reputation: 27
This is my problem.
if ord = 'd' then
Ordby:= 'name'
else
Ordby:= 'type'.
end if;
declare cursor file is
select type,name,location, from filemstr order by ordby;
begin
for i in file
loop
end;
Problem is order by ordby is not working. It always ordering by default. Is that possible to use a variable to order? I need to order this on the following condition. I don't want to declare cursor two times.
Upvotes: 0
Views: 463
Reputation: 19184
declare cursor file is
select type,name,location, from filemstr order by decode(ord,'d',name,type)
begin
for i in file
loop
end;
Upvotes: 2