Q:

Using SQL Statement in TO_DATE Function?

I have to use SQL statement in TO_DATE function. Like:
TO_DATE((select MAX(VERSION) from TABLE_B),'MM/DD/YYYY')

When I use TO_DATE like that, I encounter an error. Like:

[Error] Execution (9: 32): ORA-01858: a non-numeric character was found where a numeric was expected

Is there a way for using TO_DATE function like that?

A:

select to_date(max(version), 'mm/dd/yyyy') from table_b

might be a better choice. Note, though, that if VERSION column (it is ... what?  A string?) contains something that doesn't match that date format, TO_DATE will fail, exactly with an error you got. Therefore, make sure that data is correct.

