这是我的问题。
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;
问题是ordby的顺序不起作用。它总是默认排序。可以使用变量来订购吗?我需要在以下条件下订购。我不想两次声明光标。
答案 0 :(得分:2)
declare cursor file is
select type,name,location, from filemstr order by decode(ord,'d',name,type)
begin
for i in file
loop
end;