declare
v_var char(4) := 'Col1';
begin
declare
cursor c1 is select uomid,tomsrid,uomdesc from bduommst
order by to_number(decode(v_var,'Col1',1,'Col2',2,3),'0') desc;
begin
for r1 in c1
loop
dbms_output.put_line(r1.uomid);
end loop;
end;
end;
----- Sorry i tryied your solution but it doesn't work
---- Look at following code
----- Also see the output
declare
v_var char(4) := 'Col1';
begin
declare
cursor c1 is select uomid,tomsrid,uomdesc from bduommst
order by to_number(decode(v_var,'Col1',1,'Col2',2,3),'0') desc;
begin
for r1 in c1
loop
dbms_output.put_line(r1.uomid);
end loop;
end;
end;
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.