DECLARE statement

The DECLARE statement defines constants that act as aliases for the complete namespace names.

SYNTAX

Notes:
  1. When the NAMESPACE and NAME clauses are used the values are implicitly constant and of type CHARACTER (or CHAR).

CONSTANT

Use CONSTANT to define a constant. You can declare constants within schemas, modules, routines, or compound statements (both implicit and explicit). The behavior of these cases is as follows:

A constant or variable declared within a routine overlays any parameters of the same name, and all constants and variables of the same name declared in a containing module or schema.

This function also creates a one-to-one mapping between namespace constants and namespaces. This enables features such as content-assist (list all the valid symbols that you can enter at this point) and impact-analysis (list every reference to this element) to be incorporated.

Example

This example illustrates a namespace declaration, its use as a SpaceId in a path, and its use as a character constant in a namespace expression:

       DECLARE prefixOne NAMESPACE 'http://www.example.com/PO1';

       -- On the right hand side of the assignment a namespace constant
       -- is being used as such while, on the left hand side, one is 
       -- being used as an ordinary constant (that is, in an expression).

       SET OutputRoot.XML.{prefixOne}:{'PurchaseOrder'} = 
                      InputRoot.XML.prefixOne:PurchaseOrder;
Related concepts
ESQL overview
Related tasks
Developing ESQL
Creating dynamic field references
Related reference
Syntax diagrams: available types
ESQL statements
ESQL data types in message flows