Number-Type Literals

Vertica supports three types of numbers: integers, numerics, and floats.

  • Integers are whole numbers less than 2^63 and must be digits.
  • Numerics are whole numbers larger than 2^63 or that include a decimal point with a precision and a scale. Numerics can contain exponents. Numbers that begin with 0x are hexadecimal numerics.

Numeric-type values can also be generated using casts from character strings. This is a more general syntax. See the Examples section below, as well as Data Type Coercion Operators (CAST).


digits.[digits] | [digits].digits
digits e[+-]digits | [digits].digits e[+-]digits | digits.[digits] e[+-]digits


digits One or more numeric characters, 0 through 9
e Exponent marker


  • At least one digit must follow the exponent marker (e), if e is present.
  • There cannot be any spaces or other characters embedded in the constant.
  • Leading plus (+) or minus (–) signs are not considered part of the constant; they are unary operators applied to the constant.
  • In most cases a numeric-type constant is automatically coerced to the most appropriate type depending on context. When necessary, you can force a numeric value to be interpreted as a specific data type by casting it as described in Data Type Coercion Operators (CAST).
  • Floating point literals are not supported. If you specifically need to specify a float, you can cast as described in Data Type Coercion Operators (CAST).
  • Vertica follows the IEEE specification for floating point, including NaN (not a number) and Infinity (Inf).
  • A NaN is not greater than and at the same time not less than anything, even itself. In other words, comparisons always return false whenever a NaN is involved.
  • Dividing INTEGERS (x / y) yields a NUMERIC result. You can use the // operator to truncate the result to a whole number.


The following are examples of number-type literals:


Scientific notation:

=> SELECT NUMERIC '1e10';  
(1 row)

BINARY scaling:

=> SELECT NUMERIC '1p10'; 
(1 row)
=> SELECT FLOAT 'Infinity';
(1 row)

The following examples illustrated using the / and // operators to divide integers:

=> SELECT 40/25;       
(1 row)
=> SELECT 40//25;
(1 row)

See Also

Data Type Coercion