Working with a Single Database
From InterBase
Go Up to Declaring and Initializing Databases
In single-database programs preprocessed without the gpre -m
switch, SET DATABASE
and CONNECT
are optional. The -m
switch suppresses automatic generation of transactions. Using SET DATABASE
and CONNECT
is strongly recommended, however, especially as a way to make program code as self-documenting as possible. If you omit these statements, take the following steps:
- Insert a section declaration in the program code where global variables are defined. Use an empty section declaration if no host-language variables are used in the program. For example, the following declaration illustrates an empty section declaration:
EXEC SQL BEGIN DECLARE SECTION; EXEC SQL END DECLARE SECTION;
- Specify a database name on the
gpre
command line at precompile time. It is not necessary to specify a database if a program contains aCREATE DATABASE
statement.
For more information about working with a single database in a SQL program, see Working with Databases.