Expressions

An expression specifies a value and can take a number of different forms.

Authorization: The use of some of the expressions, such as a scalar-fullselect, sequence-reference, or function-invocation, requires having the appropriate authorization. For these objects, the privilege set that is defined below must include the following authorization:

  • cast-specification. The authorization to reference a user-defined type in a cast specification. For information about authorization considerations, see CAST specification.
  • function-invocation. Authorization to execute the function. For information about how the particular function is chosen and authorization considerations, see Function resolution.
  • scalar-fullselect. For information about authorization considerations, see Authorization.
  • sequence-reference. The USAGE privilege on the specified sequence, ownership of the sequence, Start of changeDATAACCESS authority, End of changeor SYSADM authority. For example, with a sequence reference, USAGE authorization on the sequence is required.

Privilege set: If the statement is embedded in an application program, the privilege set is the privileges that are held by the owner of the plan or package. If the statement is dynamically prepared, the privilege set is the union of the privilege sets that are held by each authorization ID of the process.

The form of an expression is as follows:

Read syntax diagram
   .-operator---------------------------------.   
   V                              (1)         |   
>>---+----+-+-function-invocation-----------+-+----------------><
     +-+--+ +-(expression)------------------+     
     '- --' +-constant----------------------+     
            +-column-name-------------------+     
            +-variable----------------------+     
            +-special-register--------------+     
            |                   (2)         |     
            +-scalar-fullselect-------------+     
            +-time-zone-specific-expression-+     
            |                  (3)          |     
            +-labeled-duration--------------+     
            |                 (4)           |     
            +-case-expression---------------+     
            |                    (5)        |     
            +-cast-specification------------+     
            |                       (6)     |     
            +-XMLCAST-specification---------+     
            |                    (7)        |     
            +-OLAP specification------------+     
            |                       (8)     |     
            +-row-change-expression---------+     
            |                    (9)        |     
            '-sequence-reference------------'     

Notes:
  1. Must be a scalar function. See Functions for more information.
  2. See Scalar-fullselect for more information.
  3. See Labeled durations for more information.
  4. See CASE expressions for more information.
  5. See CAST specification for more information.
  6. See XMLCAST specification for more information.
  7. See OLAP specification
  8. See ROW CHANGE expression
  9. See Sequence reference

operator:

Read syntax diagram
>>-+-CONCAT-+--------------------------------------------------><
   +-||-----+   
   +-/------+   
   +-*------+   
   +-+------+   
   '- ------'   

labeled-duration:

Read syntax diagram
                         (1)                       
>>-+-function-invocation-----+--+-YEAR---------+---------------><
   +-(expression)------------+  +-YEARS--------+   
   +-constant----------------+  +-MONTH--------+   
   +-column-name-------------+  +-MONTHS-------+   
   '-variable----------------'  +-DAY----------+   
                                +-DAYS---------+   
                                +-HOUR---------+   
                                +-HOURS--------+   
                                +-MINUTE-------+   
                                +-MINUTES------+   
                                +-SECOND-------+   
                                +-SECONDS------+   
                                +-MICROSECOND--+   
                                '-MICROSECONDS-'   

Notes:
  1. Must be a scalar function.