Order by after concatenating columns

oracle-11g-r2

After concatenating column how do i order by using one of the columns? Below is select statement i was trying to come up with.

SELECT * FROM (with tbl_demo AS
    (SELECT eod_date,
    branch_code branch_code
    , eoc_batch
    ,eoc_stage
    , start_time
   ,  end_time
     from aetb_eoc_programs_history where eoc_ref_no in 
     ( select eoc_ref_no from aetb_eoc_runchart_history where eod_date = (select prev_working_day from sttm_dates where branch_code = '000'))
order by eod_date)
SELECT a.bank_code||'|'||param_val||'|'|| eod_date||'|'||
branch_code ||'|'||
       eoc_batch||'|'||
        eoc_stage ||'|'||
      to_char(start_time,'dd-mm-yyyy hh24:mi:ss')
     ||'|'|| to_char(end_time,'dd-mm-yyyy hh24:mi:ss')
        ||'|'|| numtodsinterval((end_time - start_time),'day')
from tbl_demo , sttm_bank  a,cstb_param  b 
where end_time IS NOT NULL
and b.param_name = 'RELEASE'
order by  numtodsinterval((end_time - start_time),'day') desc)
where rownum <=10;

Best Answer

It is possible to ORDER BY using the ordinal value of selected fields (even a calculated value) instead of using the field name. It is hard to tell from the query above, but a generic example:

SELECT field1,field2,function(field1) FROM table ORDER BY 3;