Skip to content

Instantly share code, notes, and snippets.

@hereisfahad
Created September 6, 2025 12:14
Show Gist options
  • Select an option

  • Save hereisfahad/a0dacf57107565ceef179a3eacf06ff0 to your computer and use it in GitHub Desktop.

Select an option

Save hereisfahad/a0dacf57107565ceef179a3eacf06ff0 to your computer and use it in GitHub Desktop.
SELECT * FROM (
SELECT w.*
FROM WEB_ORDER_STATUS_NEW w
WHERE w.SYNC_STATUS = 0
AND w.ORDER_NO IS NOT NULL
AND w.ORDER_NO = '293217'
ORDER BY
w.ORDER_NO,
CASE w.BOOK_STATUS
WHEN 'ORDER RECEIVED' THEN 1
WHEN 'IN PROCESS' THEN 2
WHEN 'SENT TO PUBLISHER' THEN 3
WHEN 'Forwader to Publisher' THEN 4
WHEN 'AWAITING SHIPMENT' THEN 5
WHEN 'INVOICE' THEN 6
WHEN 'PACKED' THEN 7
WHEN 'DISPATCHED' THEN 8
WHEN 'DELIVERED' THEN 9
WHEN 'CANCELED' THEN 99
ELSE 100
END
)
WHERE ROWNUM <= 10;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment