Sorting is not the case in HH24:MI:SS MON-DD-YYYY format

Hello

The following query is not get sorted at the last date, need some suggestion to sort the query.
SELECT
CL.ID,
CL.product_serial_number "PRODUCT_SERIAL_NUMBER"
product_name CL. PROD_NAME,
CL.controller_version,
CL.license_type,
CL.system_id system_id_ip,
CL.created_by,
TO_CHAR (CL.) CREATED_DATE, 'HH24:MI:SS of MON-DD-YYYY') created_date,.
CL. Status "STATUS.
OF customer_licenses cl
order of to_char (CL.) CREATED_DATE, 'HH24:MI:SS of MON-DD-YYYY') / / desc
I also tried to give > > Order by 8


Thank you
Sudhir

To_char converts to a string. Therefore:

order of to_char (CL.) CREATED_DATE, 'HH24:MI:SS of MON-DD-YYYY') / / desc

sort strings. And the strings are compared, character from left to right. So the result is sorted first with day 31. Since you want to sort as dates, everything you nee is:

SELECT
cl.id,
cl.product_serial_number "PRODUCT_SERIAL_NUMBER",
cl.prod_name product_name,
cl.controller_version,
cl.license_type,
cl.system_id system_id_ip,
cl.created_by,
to_char(CL.CREATED_DATE, 'DD-MON-YYYY HH24:MI:SS') created_date,
cl.status "STATUS"
FROM customer_licenses cl
order by CL.CREATED_DATE desc
/

SY.

Tags: Database

Similar Questions

Maybe you are looking for

  • I use "from Internet Explorer' to store my new Favorites, but they do not appear in my 'Favorites' - where are they?

    When I changed my IE7, Firefox (and I'm very glad I did) I migrated my large list of Favorites (which was divided into subsections to make it easier to find items) to Firefox Bookmarks. I continued to bookmark web sites, I added to the sub-headings i

  • How can I change the background color by default for a Web page where none is specified?

    There are many versions I've customized the background color if none has been given to brown to go with the skin I used then. Now, I find with a simple text file is not readable with black against Brown, but I can't find today's version where to put

  • Update PS6100 SAN and ESX 5.5

    I am currently in planning phase of updating our SAN (PS6100 ver6.0.6) and our environment Vmware (5.0). My plan is to first update the SAN to 7.0.2 then updated Vmware 5.5. But according to the Dell Compatibility Guide SAN 7.0.2 firmware is not comp

  • SMS, DatagramConnection and Sprint

    Why DatagramConnection do not work on the network Sprint (CDMA) for incoming SMS? This is the method works on GSM device, but does not work on Sprint (CDMA). I use the Port "0" to listen to the incoming text message.

  • Reset password CISCO SG500

    Try to reset the password of admin for a switch of SG500. I have access to the consoles. It looks a lot like this: https://supportforums.Cisco.com/discussion/11523086/SG200-26-password-reset However when I press 3 to select the password recovery proc