• I think you can not use variable in order by clause.

    Variables are only allowed when ordering by an expression referencing a column name.