ORDER BY CASE
WHEN v_SORT_TYPE = 'ASC' THEN
CASE
WHEN v_SORT_ORDER = 'lname' THEN CAST(lname AS VARCHAR2(45)) || ',' || ROWNUM
WHEN v_SORT_ORDER = 'code' THEN CAST(code AS VARCHAR2(52)) || ',' || ROWNUM
END ASC
WHEN v_SORT_TYPE = 'DSC' THEN
CASE
WHEN v_SORT_ORDER = 'lname' THEN CAST(lname AS VARCHAR2(45)) || ',' || ROWNUM
WHEN v_SORT_ORDER = 'code' THEN CAST(code AS VARCHAR2(52)) || ',' || ROWNUM
END DESC
END
I am trying to write conditions for when v_SORT_TYPE is passed in as ASC or DSC. I am getting compilation error in this.
I assume this would be a common thing to do in my pl/sql SP's.
where am I going wrong?