select max(to_number(ltrim(aefo_number,'VE')))
from exemption
where aefo_number like 'E%'
or aefo_number like 'V%'
I am getting Function to_number(text) does not exist error for the above select statement and I am unable to convert it.
If anyone know the syntax for the select statement please let me know
2
Answers
Unlike Oracle, Postgres’
to_number()
function always needs a format mask. So you would need something liketo_number(ltrim(aefo_number,'VE'), '99999999999')
If you don’t want to (or can’t) specify a format mask, you could cast the value to a
numeric
oderinteger
:If
V
andE
are only the first character then you can use:fiddle