Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8009853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:34:05+00:00 2026-06-04T18:34:05+00:00

I have a column in a VIEW that contains date values in the format

  • 0

I have a column in a VIEW that contains date values in the format of ‘MM/DD/YYYY’.

If this column only contained date values in the format I listed, I could do an ORDER BY on the column with a TO_DATE on it to get the VIEW to sort by that date:

ORDER BY TO_DATE(MY_DATE_COLUMN, 'MM/DD/YYYY') desc

However, there’s data in this column that’s not formatted as ‘MM/DD/YYYY’.

Is there anyway just using SQL to be able to sort on this column being realized as a DATE column?

I’m thinking that it’s not possible due to the data that is not formatted as ‘MM/DD/YYYY’, but I’m not totally sure…

I don’t want to add another column in the VIEW to accomplish this as well.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T18:34:07+00:00Added an answer on June 4, 2026 at 6:34 pm

    You could create a function on this column that tries to convert the date, but catches any exceptions, and sort by that.

    You can also nest the exceptions and try several formats for conversion before defaulting to some date of your choosing. eg.

    CREATE OR REPLACE FUNCTION my2date( p_str in VARCHAR2) RETURN DATE is
    
    BEGIN
          RETURN to_date( p_str, 'MM/DD/YYYY' );
    EXCEPTION WHEN OTHERS THEN
        BEGIN
            RETURN to_date( p_str, 'DD/MM/YYYY');
        EXCEPTION WHEN OTHERS THEN
            RETURN sysdate; /* or some other fixed date - depends on if you want these first or last */
        END;
    END;
    /
    

    Then just use the clause:

    ORDER BY my2date(MY_DATE_COLUMN) desc;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a view that contains a calculated column. Is there are a way
I have one grid view that contains some template columns. In this, the first
I have a view that has a column to make it sortable. When clicking
I have a table that contains a column of XML Datatype (column name FileContent).
I have view that contains a table with the following structure: <table id=mappings> <thead>
I have a table that contains a column that is XML data type. I
I have a view which contains a users id and an image column. Here's
I have a ListBox that contains a Grid. The Grid has a Label Column,
I have a table that has a column that contains links. Each cell in
I have a table that contains a column named views. Each time the user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.