I have a col which stores the date, but it is in a numerical format in 8 digits (e.g. 20220613) how can I split it and check with the condition?
- for the first 4 digits, I need to valid is it earlier than current year,
- for the middle 2 digits, I need to valid is it between 01 - 12,
- for the last 2 digits, I need base on the month to valid is it between 01 - 31 (e.g. if the the middle 2 digits (month) is 06, the last 2 digits can not greater than 31)
May I know that how to write this logic in oracle sql query? Thanks.