Scalar. Converts the value of one datatype to another datatype allowing overflows and truncation.
cast ( type, number )
type | Any datatype, except binary or string. |
number | A datatype that can be cast to the new specified datatype. |
The type argument must be a numeric type, money type, or a date/time type. You can cast expressions of any type except binary or string types.
Casting from larger types to smaller types may cause overflow. Casting from decimal types (like float or money) to nondecimal types (like integer) truncates the decimal portion. Both overflows and truncation are allowed. Use this function to force a cast in places where an implicit cast is disallowed, such as when converting an integer to a long.
When comparing values of varying scale, cast one value to the other to make the two values compatible. For example, you can compare money values of different scale only by casting to a common type.
You may prefer to cast lower scale values to higher scale values to avoid incorrect comparison results and to maintain scale.
cast ( integer, 1.23) returns 1.