1. 0 - expire
  2. 1 - approval
  3. 2 - pending
  4. 3 - counting
  5.  
  6. 1 - approval ,
  7. 3 - counting,
  8. 0 - expire
  9. 2 - pending.
  10.  
  11. -- sampe of data from 0 to 3
  12. SQL> with t1(x) as(
  13. 2 select level - 1
  14. 3 from dual
  15. 4 connect by level <= 4
  16. 5 )
  17. 6 select * -- actual query
  18. 7 from t1
  19. 8 order by case x
  20. 9 when 0 then 'expire'
  21. 10 when 1 then 'approval'
  22. 11 when 2 then 'pending'
  23. 12 when 3 then 'counting'
  24. 13 end
  25. 14 ;
  26. X
  27. ----------
  28. 1
  29. 3
  30. 0
  31. 2