Starting Without SET TRANSACTION

From InterBase

Go Up to Starting the Default Transaction


Simple, single transaction programs can omit SET TRANSACTION. The following program fragment issues a SELECT statement without starting a transaction:

. . .
EXEC SQL
SELECT * FROM CITIES
WHERE POPULATION > 4000000
ORDER BY POPULATION, CITY;
. . .

A programmer need only start the default transaction explicitly in a single transaction program to modify its operating characteristics or when writing a DSQL application that is preprocessed with the gpre -m switch.

During preprocessing, when gpre encounters a statement, such as SELECT, that requires a transaction context without first finding a SET TRANSACTION statement, it automatically generates a default transaction as long as the -m switch is not specified. A default transaction started by gpre uses a predefined, or default, behavior that dictates how the transaction interacts with other simultaneous transactions attempting to access the same data.

Important:
DSQL programs should be preprocessed with the gpre -m switch if they start a transaction through DSQL. In this mode, gpre does not generate the default transaction as needed, but instead reports an error if there is no transaction.

For more information about transaction behaviors that can be modified, see Specifying SET TRANSACTION Behavior. For more information about using the gpre -m switch, see Preprocessing, Compiling, and Linking.

Advance To: