you did not get it:
ORDER BY case when :input = 1 then 1 end DESC,--sort by first column(positon 1)
i.e. A
case when :input = 2 then 2 end DESC--sort by second column(position
2) i.e. B
is the SAME as, IDENTICAL to:
ORDER BY case when :input = 1 then 'A' end DESC,--sort by first column(positon 1)
i.e. A
case when :input = 2 then 'B' end DESC--sort by second column(position
2) i.e. B
you cannot dynamically return a column position, you dynamically returned A CONSTANT, A NUMBER, A CONSTANT VALUE - JUST A VALUE
order by <ordinal position> | <expression>
you are returning an expression - not an ordinal position.