0
I am performing a database search in order to return only the characteristics that are between the range of 40 and 100. But when running the script below it is returning me other features that are not related to the searched. Apparently this is happening because the values 6.7 and 8.7 are being considered as 67 and 87 thus staying 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
By running this SQL you are returning these records to me:
returned this: ERROR: field bursting Numeric DETAIL: A field with accuracy 1, scale 0 must round to an absolute value less than 10 1.
– Gabriel Schmidt Cordeiro
I forgot a detail. What is the maximum amount of digits you will have in the entire part of the number? This will be the amount of 9s you will get in the entire string. For example: 1800 Megapixels, 4 nines =>
'9999.9999999'
– Juliano Alves