Page 1 of 1
Is there an INT funtion in vertica?
Posted: Sat Jun 13, 2015 9:07 pm
by usli06
Hi,
Is there a function in Vertica like the INT function in Oracle?
Example INT(4.56) would be 4.
Thanks!
Re: Is there an INT funtion in vertica?
Posted: Sun Jun 14, 2015 3:56 am
by NorbertKrupa
Are you just looking for the FLOOR function?
Code: Select all
dbadmin=> SELECT FLOOR('4.56');
FLOOR
-------
4
(1 row)
Re: Is there an INT funtion in vertica?
Posted: Tue Jun 16, 2015 2:58 am
by usli06
Yeah, thanks Norbert! For some reason I thought I tried that function and observed rounding issues, so I was using the TRUNC function, like this:
Code: Select all
dbadmin=> SELECT FLOOR(4.56), TRUNC(4.56)::INT;
FLOOR | TRUNC
-------+-------
4 | 4
(1 row)
The FLOOR function is obviously the better choice