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!

Convert random string to date format

The_Cute_DBANov 10 2022

Hello Experts,
I would like to ask help on how to convert the string sample below to a date format.

select * from ficticious_table;

ID     LNAME     FNAME     HIRE_STR
------------------------------------------
100    Smith     John      HIREAUG2021_10
101    Heath     Mary      HIRESEP2021_02
102    Grant     Joe       HIREOCT2022_20
103    Hay       Mark      HIRENOV2022_05

So, in this case, I would like to convert the HIRE_STR column into a valid DATE format so I can compare it to SYSDATE or any date values.
For example, I would like to list employees who were hired within the last 2 months, in that case I should get Joe (Oct 20, 2022) and Mark (Nov 5, 2022).

This post has been answered by Bhavani Dhulipalla on Nov 10 2022
Jump to Answer
Comments
Post Details
Added on Nov 10 2022
24 comments
2,752 views