Specify a numeric value.
Syntax
| | |
<term> <numeric value expression> + <term> <numeric value expression> - <term> |
<factor> ::= [ { + | - } ] <numeric primary>
Notes
♦ | The declared type of a numeric primary shall be a numeric type. |
♦ | If both operands are exact numeric types, then the data type of the result is an exact numeric type with precision not less than the maximum precision of the two operands and the scale determined as follows: |
♦ | If addition or subtraction is specified, then the scale is the maximum of the two operands. |
♦ | If multiplication is specified, then the scale is the sum of the two operand scales, limited by the maximum scale of 4. |
♦ | If division is specified, then the scale is the maximum scale 4. |
♦ | If either of the operands are an approximate numeric type, then the result is an approximate numeric type with precision not less than the maximum precision of the two operands. |
♦ | Normal operator precedence is applied. |
See also: Numeric Value Functions
Examples
1) | The following example raises all teacher salaries by a given percent: |
UPDATE teachers
SET salary = salary * ( 1 + ( :percent / 100 ) )
2) | Some examples of valid numeric value expressions: |
♦ | -5 |
§ 3 + 1
§ 7/3-16
§ 15 * ( 5-4 )
Conformance
SQL:2003 standard |
- |
Core SQL |