SQL$HELP72.HLB  —  DECLARE  ALIAS  Arguments

1  –  alias ALIAS

    Specifies a name for the attach to the database. Specifying an
    alias lets your program refer to more than one database.

    You do not have to specify an alias in the DECLARE ALIAS
    statement. The default alias in interactive SQL and in
    precompiled programs is RDB$DBHANDLE. In the SQL module language,
    the default is the alias specified in the module header. Using
    the default alias (either by specifying it explicitly in the
    DECLARE ALIAS statement or by omitting any alias) makes the
    database part of the default environment. Specifying a default
    database means that statements that refer to the default database
    do not need to use an alias.

    If a default alias was already declared and you specify the
    default alias in the alias clause (or specify any alias that
    was already declared), you receive an error when you precompile
    the program or process it with the SQL module processor.

2  –  database-options

    By default, SQL uses only the database options used to compile
    a program as valid options for that program. If you want to use
    the program with other supported databases, you can override the
    default options by specifying database options in the ATTACH or
    DECLARE ALIAS statement.

    For more information on database options, see the Database_
    Options HELP topic.

3  –  DBKEY_SCOPE

    Syntax options:

    DBKEY SCOPE IS ATTACH | DBKEY SCOPE IS TRANSACTION

    Controls when the database key of a deleted row can be used again
    by SQL.

    o  The default DBKEY SCOPE IS TRANSACTION means that SQL can
       reuse the database key of a deleted table row (to refer to a
       newly inserted row) as soon as the transaction that deleted
       the original row completes with a COMMIT statement. (If the
       user who deleted the original row enters a ROLLBACK statement,
       then the database key for that row cannot be used again by
       SQL.)

       During the connection of the user who entered the DECLARE
       ALIAS statement, the DBKEY SCOPE IS TRANSACTION clause
       specifies that a database key is guaranteed to refer to the
       same row only within a particular transaction.

    o  The DBKEY SCOPE IS ATTACH clause means that SQL cannot use the
       database key again (to refer to a newly inserted row) until
       all users who have attached with DBKEY SCOPE IS ATTACH have
       detached from the database.

       It only requires one process to attach with DBKEY SCOPE
       IS ATTACH to force all database users to assume this
       characteristic.

    o  Oracle Corporation recommends using DBKEY SCOPE IS TRANSACTION
       to prevent excessive consumption of storage area space by
       overhead space needed to support DBKEY SCOPE IS ATTACH, and to
       prevent performance problems when storing new rows.

       During the connection of the user who entered the DECLARE
       ALIAS statement, the DBKEY SCOPE IS ATTACH clause specifies
       that a database key is guaranteed to refer to the same row
       until the user detaches from the database.

    See the DBKEY HELP topic for more information.

4  –  DEFAULT_CHARACTER_SET

    Specifies the default character set of the alias at compile
    time. For a list of allowable character set names, see Supported
    Character Sets.

5  –  DISPLAY CHARACTER SET support-char-set

    Specifies the character set encoding and characteristics expected
    of text strings returned from Oracle Rdb.

6  –  FILENAME

    A quoted string containing full or partial information needed to
    access a database.

    For an Oracle Rdb database, an attach specification contains the
    file specification of the .rdb file.

    When you use the FILENAME argument, any changes you make to
    database definitions are entered only to the database system
    file, not to the repository. If you specify FILENAME, your
    application attaches to the database with that file name at run
    time.

    If you specify FILENAME:

    -  During compilation, your application attaches to the specified
       database and reads metadata from the database definitions.

    -  At run time, your application attaches to the specified
       database.

    For information regarding node-spec and file-spec, see Oracle Rdb
    Attach Specifications.

7  –  FOR_COMPILETIME

    Optional keyword provided for upward compatibility: DECLARE ALIAS
    specifies the compile-time environment by default. Specifies that
    the alias declared is the source of the database definition for
    program compiling and execution.

8  –  lit-or-def-user-authentication

    Specifies the user name and password to enable access to
    databases, particularly remote databases.

    You can use this clause to explicitly provide user name and
    password information in the DECLARE ALIAS statement.

9  –  literal-user-auth

    Specifies the user name and password for the specified database
    to be accessed at run time. For more information about when to
    use this clause, see the ATTACH statement.

10  –  MULTISCHEMA_IS

    Syntax options:

    MULTISCHEMA IS ON | MULTISCHEMA IS OFF

    The MULTISCHEMA IS ON clause enables multischema naming for the
    duration of the database attach. The MULTISCHEMA IS OFF clause
    disables multischema naming for the duration of the database
    attach. Multischema naming is disabled by default.

11  –  NATIONAL_CHARACTER_SET

    Specifies the national character set of the alias at compile
    time. For a list of allowable character set names, see Supported
    Character Sets.

12  –  PATHNAME

    A full or relative repository path name that specifies the
    source of the database definitions. When you use the PATHNAME
    argument, any changes you make to database definitions are
    entered in both the repository and the database system file.
    Oracle Rdb recommends using the PATHNAME argument if you have the
    repository on your system and you plan to use any data definition
    statements.

    If you specify PATHNAME:

    o  During compilation, your application attaches to the
       repository database definition and reads metadata from the
       dictionary definitions. SQL extracts the file name of the
       Oracle Rdb database from the dictionary and saves it for use
       at run time.

    o  At run time, your application attaches to the Oracle
       Rdb database file name extracted from the dictionary at
       compilation.

13  –  PRESTARTED_TRANSACTIONS_ARE

    Syntax options:

    PRESTARTED TRANSACTIONS ARE ON | PRESTARTED TRANSACTIONS ARE OFF

    Specifies whether Oracle Rdb enables or disables prestarted
    transactions.

    Use the PRESTARTED TRANSACTIONS ARE OFF clause only if your
    application uses a server process that is attached to the
    database for long periods of time and causes the snapshot file
    to grow excessively. If you use the PRESTARTED TRANSACTIONS ARE
    OFF clause, Oracle Rdb may require additional I/O as each SET
    TRANSACTION statement must reserve a transaction sequence number
    (TSN).

    For most applications, Oracle Rdb recommends that you enable
    prestarted transactions. The default is PRESTARTED TRANSACTIONS
    ARE ON. If you use the PRESTARTED TRANSACTIONS ARE ON clause or
    do not specify the PRESTARTED TRANSACTIONS clause, the COMMIT
    or ROLLBACK statement for the previous read/write transaction
    automatically reserves the TSN for the next transaction and
    reduces I/O.

    You can use ALTER DATABASE . . . PRESTARTED TRANSACTIONS clause
    to establish a default setting for all applications using the
    database. You can also define the RDMS$BIND_PRESTART_TXN logical
    name to define the default setting for prestarted transactions
    outside of an application. The PRESTARTED TRANSACTION clause
    overrides this logical name and database setting. For more
    information, see the Oracle Rdb7 Guide to Database Performance
    and Tuning.

14  –  RESTRICTED_ACCESS

    Syntax options:

    RESTRICTED ACCESS | NO RESTRICTED ACCESS

    Restricts access to the database. This allows you to access the
    database but locks out all other users until you disconnect from
    the database. Setting restricted access to the database requires
    DBADM privileges.

    The default is NO RESTRICTED ACCESS if not specified.

15  –  ROWID_SCOPE

    Syntax options:

    ROWID SCOPE IS ATTACH | ROWID SCOPE IS TRANSACTION

    The ROWID keyword is a synonym for the DBKEY keyword. See the
    DBKEY_SCOPE argument for more information.

16  –  RUNTIME

    Specifies the source of the database definitions when the program
    is run.

17  –  runtime-string

    A quoted string or parameter that specifies the file name or path
    name of the database to be accessed at run time, and optionally,
    the user name and password of the user accessing the database at
    run time.

18  –  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.

19  –  USER

    Syntax options:

    username | DEFAULT

    Specifies the operating system user name that the database system
    uses for privilege checking.

    You can specify a character string literal for the user name or
    you can specify the DEFAULT keyword. The DEFAULT keyword allows
    you to avoid placing the user name in a program's source code.
    If you specify the DEFAULT keyword, you pass the user name to the
    program by using a command line qualifier when you compile an SQL
    module or precompiled program. You use the USERNAME qualifier.

20  –  USING

    Syntax options: USING 'password' | DEFAULT

    Specifies the user's password for the user name specified in the
    USER clause.

    You can specify a character string literal for the PASSWORD or
    you can specify the DEFAULT keyword. The DEFAULT keyword allows
    you to avoid placing the user name in a program's source code.
    If you specify the DEFAULT keyword, you pass the password to the
    program by using a command line qualifier when you compile an SQL
    module or precompiled program. You use the PASSWORD qualifier.
Close Help