SQL$HELP72.HLB  —  DECLARE  ALIAS  Arguments  scope-options
    LOCAL | GLOBAL | EXTERNAL

    Specifies the scope of the alias declaration in precompiled SQL
    or SQL module language.

    The scope-option declarations are:

    o  LOCAL declares an alias that is local to procedures in the
       module in which it is declared, or local to dynamic statements
       prepared in the module in which it is declared.

       SQL attaches to a database with LOCAL scope only when you
       execute a procedure in the same module without a session. The
       alias of a database with LOCAL scope pertains only to that
       module.

       If the execution of a procedure in another module has attached
       to the implicit environment and that procedure subsequently
       calls another procedure that references a local database, SQL
       attempts to attach to that local database. If no transaction
       is active, SQL adds the local database to the implicit
       environment for this module. If a transaction is active, SQL
       returns an error message.

    o  GLOBAL declares an alias definition that is global to
       procedures in the application. GLOBAL is the default.

    o  EXTERNAL declares an external reference to a global alias that
       is defined in another module.

    In single-image applications, the distinction between alias
    definitions and alias references is often unimportant. It is
    only necessary that each alias have at least one definition.
    For this reason, Oracle Rdb has treated all alias references
    (declared with the EXTERNAL keyword) the same as alias
    definitions (declared with the GLOBAL keyword or the default.)
    For compatibility with previous versions, this remains the
    default.

    However, applications that share aliases between multiple
    images require a distinction between alias definitions and
    alias references. All definitions of any aliases shared between
    multiple OpenVMS images must be defined in one image, generally
    the shareable image against which you link the other images.

    Oracle Rdb recommends that you distinquish alias definitions
    from alias references in any new source code. Use the GLOBAL (or
    default) scope keyword for alias definitions and the EXTERNAL
    keyword for alias references. If you share aliases between
    multiple OpenVMS images, use the NOEXTERNAL_GLOBALS command line
    qualifier to override the default and cause SQL to properly treat
    alias references as references.

    If you use the EXTERNAL_GLOBAL command line qualifier, SQL treats
    aliases declared with the EXTERNAL keyword as GLOBAL. That is,
    SQL initializes alias references as well as alias definitions.

    If you use the NOEXTERNAL_GLOBAL command line qualifier, SQL
    treats aliases declared with the EXTERNAL keyword as alias
    references and does not initialize them. It initializes all other
    aliases.

    The EXTERNAL_GLOBAL qualifier is the default.

    The [NO]INITIALIZE_HANDLES command line qualifiers also affect
    the initialization of aliases, but they are recommended only for
    use in versions prior to V7.0.

    See the SQL Module Language and SQL Precompiler help topics for
    more information about the command line qualifiers.
Close Help