SETNEQ Operator

Description

The SETNEQ operator returns TRUE(1) if a first operand is different from a second operand. A comparable operation can be performed for all collection data types.

Syntax

collection_operand SETNEQ collection_operand

Example

--selecting rows when two collection_operands are not same in the WEHRE clause

SELECT id, name, address, zip_code FROM contain_tbl WHERE address SETNEQ {'country','state', 'city'};

           id  name                  address               zip_code

===============================================================================

            1  'Kim       '          {'country', 'state'}  {1, 2, 3}

            2  'Moy       '          {'country', 'state'}  {3, 2, 1}

            4  'Smith     '          {'city', 'country', 'state', 'street'}  {1, 2, 3, 4}

            5  'Kim       '          {'city', 'country', 'state', 'street'}  {1, 2, 3, 4}

            6  'Smith     '          {'city', 'country', 'state', 'street'}  {1, 2, 3, 5}

            7  'Brown     '          {'city', 'country', 'state', 'street'}  {} 

 

6 rows selected.

 

--selecting rows when two collection_operands are not same in the WEHRE clause

SELECT id, name, address, zip_code FROM contain_tbl WHERE zip_code SETNEQ {1,2,3};

           id  name                  address               zip_code

===============================================================================

            2  'Moy       '          {'country', 'state'}  {3, 2, 1}

            3  'Jones     '          {'city', 'country', 'state'}  {1, 2, 3, 4}

            4  'Smith     '          {'city', 'country', 'state', 'street'}  {1, 2, 3, 4}

            5  'Kim       '          {'city', 'country', 'state', 'street'}  {1, 2, 3, 4}

            6  'Smith     '          {'city', 'country', 'state', 'street'}  {1, 2, 3, 5}

            7  'Brown     '          {'city', 'country', 'state', 'street'}  {}