Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Order by not working

699582Jan 8 2010 — edited Jan 8 2010
Hi,

Does anyone know why my order by is not working correctly, before I had an oracle error using distinct in my select statement, so i had to remove the order by, but the SQL is working fine for this query now, and all my data is correct. Just my order by is incorrect.
SELECT distinct I.SKU_ID, I.LOCATION_ID, TO_CHAR(I.EXPIRY_DSTAMP, 'DD-Mon-YYYY'), to_char(trunc(I.EXPIRY_DSTAMP) - trunc(S.SHIP_SHELF_LIFE), 'DD-Mon-YYYY'), S.SHIP_SHELF_LIFE
FROM INVENTORY I, SKU S
WHERE I.EXPIRY_DSTAMP - S.SHIP_SHELF_LIFE < SYSDATE + $P{days}
AND S.SKU_ID = I.SKU_ID
order by TO_CHAR(I.EXPIRY_DSTAMP, 'DD-Mon-YYYY') asc
Regards,

SM.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 5 2010
Added on Jan 8 2010
16 comments
2,610 views