Specifies the alias for the implicit database declaration
executed by the CREATE DATABASE statement. An alias is a name for
a particular attach to a database that identifies that database
in subsequent SQL statements.
NOTE
If you attach to a database using an alias, you must use
that alias in subsequent statements to qualify the names of
elements in that database.
If you omit the FILENAME argument from the database root file
parameters, SQL also uses the alias as the file name for the
database root file and creates the root file in the current
default directory. (SQL generates a syntax error if you include
a disk or directory specification in the alias clause.) You must
specify either the FILENAME or alias argument.
Schema elements in the CREATE DATABASE statement do not need to
use the alias, however, they cannot specify any other alias.
The alias clause is optional. 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 ALIAS clause or omitting the ALIAS clause)
declares the database as the default database. Specifying a
default database means that statements outside the CREATE
DATABASE statement that refer to the default database do not
need to use an alias.
If a default database was already declared, and you specify the
default alias in the ALIAS clause (or specify any alias that was
already declared), the results depend on the environment in which
you issue the CREATE DATABASE statement.
o In interactive SQL, you receive a prompt asking if you want
to override the default database declaration. Unless you
explicitly override the default declaration, the CREATE
DATABASE statement fails.
SQL> -- Assume a default database has been declared:
SQL> --
SQL> -- Now create a database without an alias.
SQL> -- SQL asks if you want to override the default:
SQL> CREATE DATABASE FILENAME test;
This alias has already been declared.
Would you like to override this declaration (No)? NO
%SQL-F-DEFDBDEC, A database has already been declared with the default
alias
o In embedded SQL or in the SQL module language, specifying
an already-declared alias in the CREATE DATABASE statement
generates an error when you precompile the program or compile
the module.
o In dynamic SQL, specifying an already-declared alias overrides
the earlier declaration.
For more information about default databases, see the User_
Supplied_Names HELP topic.