I am performing a search in the database with the purpose of returning only the features that are between the range of 40 and 100. But when I run the script below it is returning me other features that are not related to the searched. Apparently this is occurring because the values 6.7 and 8.7 are being considered as 67 and 87 thus getting between the range of 40 and 100.
SELECT carlis_nome
FROM caracteristica
JOIN caracteristica_lista
ON caracteristica_lista.caracteristica_id = caracteristica.caracteristica_id
WHERE caracteristica.caracteristica_id = 11
AND CASE
WHEN caracteristica_lista.carlis_nome ~ '^[0-9]'
THEN TO_NUMBER(caracteristica_lista.carlis_nome, '999999999')
ELSE 0
END BETWEEN 40
AND 100
When executing this SQL is returning me these records: