I want to use the following date expression in my select query:
to_date(substr(description,1,8),'mm/dd/yy') as deposit_date
This works fine as long as the first 8 characters represent a valid date in 'mm/dd/yy' format. Unfortunately, occassionly the description field contains bad data. In this case I would like to return null for deposit_date, but the above expression fails with an error instead. Any ideas? I know I can do it with PL/SQL and error trapping, but I'm hoping there is an easier way.
to_date(substr(description,1,8),'mm/dd/yy') as deposit_date
This works fine as long as the first 8 characters represent a valid date in 'mm/dd/yy' format. Unfortunately, occassionly the description field contains bad data. In this case I would like to return null for deposit_date, but the above expression fails with an error instead. Any ideas? I know I can do it with PL/SQL and error trapping, but I'm hoping there is an easier way.