Chat now with support
Chat with Support

Toad for DB2 7.4 - Installation Guide

Supported Operators

Toad supports both binary and unary operators. A binary operator takes a left and a right value and returns a resulting value. A unary operator takes the value on its right and returns a new value in its place.

Toad supports the following operators:

Operator

Description

Examples

+

Binary plus operator that adds the left and right values numerically.

10 + 5

(Results in 15)

-

Binary minus operator that subtracts the left from right values numerically.

10 – 5

(Results 5)

+

Unary operator that does not perform an operation.

+10

(Results in 10)

-

Unary operator that negates the numerical value of the operator.

-10

(Results in 10)

||

String concatenation binary operator that concatenates the strings of the left and right operand.

10 || 5

(Results in 105)

 

’r;Hello’ || ’r;World’

(Results in ’r;HelloWorld’)

*

Binary multiply operator that multiplies the left and right values numerically.

10 * 5

(Results in 50)

/

Binary divide operator that divides the left and right values numerically.

10 / 5

(Results in 2)

%

Binary modulo operator that results in the modulo of dividing left and right values numerically. 

8 % 5

(Results in 3)

(

Unary group operator that evaluates everything until a ) operator and returns the result.

( 1 + 2 ) * 3

(Results in 9)

(

Binary group operator that evaluates the identifier to its left with the values specified by the values on its left until ended by an ) operator.

substring(’r;Hello’,1,2

(Results in ’r;He’)

&

Bitwise AND operator that performs a bitwise AND of the left and right values as integers.

5 & 4

(Results in 4)

|

Bitwise OR operator that performs a bitwise OR of the left and right values as integers.

3 | 5

(Results in 7)

[

Unary array group operator that evaluates everything until a ] operator and returns the result as an array. 

[ 1, 2 ]

(Results in an array with a 1 and a 2 in it)

[

Binary array group operator. that tries to get the item of the array of the left value specified by its right item.

[ 1, 2 ] [ 0 ]

(Results in 1)

,

Binary value separator operator. that separates values in an array or evaluation call (See binary group operator ’r;(’r;).

[ 1, 2]

(Results in an array with a 1 and a 2 in it)

!

Unary not operator that returns the Boolean negate of the value on its right.

! ( 1 < 2 )

(Results in false)

AND

Binary and operator that returns the Boolean and of the left and right values.

1 < 2 and 2 < 1 

(Results in false)

OR

Binary OR operator that returns the Boolean OR of left and right values.

1 < 2 or 2 < 1  

(Results in true)

IN

Binary IN operator that returns true if the left operand is equal to the value on the right or if the value is an array of any of the items in the array.

1 in ( 1, 2 )

(Results in true)

=

Binary equality operator that returns true if the left and right operands are the same

1 = 2

(Results in false)

!=

Binary non equality operator that returns true if the left and right operands are not the same.

1 != 2

(Results in true)

<=

Binary less than or equal operator that returns true if the left operand is less than or equal to the right one.

1 <= 2

(Results in true)

<

Binary less than operator that returns true if the left operand is less than the right one.

1 < 2

(Results in true)

>=

Binary greater than or equal operator that returns true if the left operand is greater than or equal to the right one.

1 >= 2

(Results in false)

>

Binary greater than operator that returns true if the left operand is greater than the right one. 

1 > 2

(Results in false)

All numerical computation is made using a double data type. If an operand is null, the resulting value of any operation is still null as is the standard in SQL. Operators with real names are matched case insensitive.

Operator Precedence

Operator evaluation takes place from left to right and evaluation is never a shortcut for boolean operators. The operators have the following precedence order (lower number precedences are evaluated first). 

Precedence

Operator

0

(, [

1

), ]

2

!, + (unary), - (unary)

3

/, *, %

4

+, -, ||

5

<=, <, >, >=

6

=, !=, IN

7

&, |

8

AND, OR

9

,

 

Related Topics

About Debugging SQL 

Supported Expressions

Add Watches

Set Breakpoints 

Related Documents

The document was helpful.

Select Rating

I easily found the information I needed.

Select Rating