3. Elements of SQL Statements : Predicates in SQL : IS INTEGER Predicate
 
Share this page                  
IS INTEGER Predicate
Use IS INTEGER to determine if a particular result can be assigned to a column of the given data type. It is especially useful for cleaning data or validating data input.
The IS INTEGER predicate takes the following form:
IS [NOT] INTEGER
For example:
x IS INTEGER
is true if x is integer in form. If x is a string, then this will be true if the value is a number where any fractional digits are zero and the signed result can be stored in an int8. Any leading or trailing white space is ignored. If x is a DECIMAL or a FLOAT value, then this predicate is true if the value can be stored in an int8 column and any fractional digits are zero.
If all values in a column pass this predicate, then the whole column can be coerced into a int8 column.
The following predicates are all true:
' +12345 ' IS INTEGER
'1.000000' IS INTEGER
1.0e10 IS INTEGER
DECIMAL('1234567890123456789012345', 25,0) IS NOT INTEGER
'number' IS NOT INTEGER
'123 456' IS NOT INTEGER