Navigation:  NexusDB Guide > SQL Reference > Value Expressions >

Numeric Value Expressions

Previous pageReturn to chapter overviewNext page

NexusDB V3 Manual

Numeric Value Expressions

button_main button_prev button_next

NexusDB Manual V3 > SQL Reference > Value Expressions

Specify a numeric value.

 

Syntax

 

<numeric value expression> ::=

<term> ::=

 

 

|

|

 

<factor>

<term> * <factor>

<term> / <factor>

<factor> ::= [ { + | - } ] <numeric primary>

 

<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

 

© Nexus Database Systems Pty Ltd.

nexus_logo