NUM() Function – Convert String to Numeric

Syntax

NUM(string)

Description

The NUM() function converts a string argument to a numeric equivalent. The string argument must conform to the rules for numeric constants. In each of these cases, ODBC 2.0 will recognize any sequence of characters conforming to the following rules:

  • Leading and trailing spaces are ignored. A number may not contain embedded spaces.

  • A number must begin with either a "+" ,"-", ".", or a digit.

  • A number may have any number of digits. Any digits beyond the maximum precision are rounded and discarded.

  • An exponent may be given by following the number with an "E" or "e" , an optional sign ("+" or "-"), and any number of digits.

  • Overflow and underflow may occur. An overflow generates an error. An underflow becomes zero.

  • A null string or a string of all spaces is valid and becomes zero.

Example

Select NUM(CUST_CODE) from CUST_HEAD