Progress
Embedded SQL-92
Guide and Reference


Starting a Transaction

The database implicitly starts a transaction with the first executable SQL statement in an ESQL program. When an active transaction exists, a subsequent executable SQL statement does not begin a new transaction.

EXAMPLE

In the following code fragment, a new transaction begins when the database executes the CREATE TABLE statement. Executing the INSERT statement does not start a new transaction since an active transaction already exists:

EXEC SQL
     CONNECT TO DEFAULT ;
/* 
** CREATE the customer table in the database.
** This is the first executable statement, and
** the database implicitly starts a new transaction.
*/
EXEC SQL
     CREATE TABLE customer 
     (
          cust_no INTEGER NOT NULL,
          last_name CHAR (30),
          street CHAR (30),
          city CHAR (20),
          state CHAR (2)
     ) ;
 
/*
** INSERT values into the customer table 
*/
EXEC SQL
     INSERT INTO customer
          (cust_no, last_name, street, city, state)
     VALUES
          (:cust_no_v, :name_v, :street_v, :city_v, :state_v) ;
 
EXEC SQL
     COMMIT WORK ;
 
EXEC SQL
     DISCONNECT DEFAULT ; 

NOTE: Declarative statements do not start a transaction.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095