I'm new in sql and I have question, hope you can help me.
How can I order the below data by calendar period. The datatype is VarChar2
Jan-2020
Feb-2020
Mar-2019
Jan-2019
Feb-2019
Mar-2020
Thank you in advance!
I'm new in sql and I have question, hope you can help me.
How can I order the below data by calendar period. The datatype is VarChar2
Jan-2020
Feb-2020
Mar-2019
Jan-2019
Feb-2019
Mar-2020
Thank you in advance!
You can turn the string to a date to_date() and use it for ordering:
order by to_date(mycol, 'mon-yyyy')
If the language of your database or session is not English, you need an additional argument so Oracle can understand the month name:
order by to_date(mycol, 'mon-yyyy', 'nls_date_language = american')