Embedded SQL statements

This appendix summarizes the statements recognized by gixpp. Each statement is written between EXEC SQL and END-EXEC. Statements marked with [AT conn] accept the AT clause to choose a connection.

Statement Description See
BEGIN DECLARE SECTION, END DECLARE SECTION delimit the host variables (optional) Precompiler concepts
INCLUDE name include a copybook (SQLCA…) Precompiler concepts
VAR item IS type give an SQL type to a host variable Host variables and datatypes
DECLARE name CURSOR [WITH HOLD] FOR select declare a cursor Embedded SQL statements
DECLARE name CURSOR [WITH HOLD] FOR stmt declare a cursor on a prepared statement Dynamic SQL
DECLARE name TABLE (...) declare a table (ignored)
CONNECT TO src [AS conn] [USER usr [USING pwd]] connect Connections and transactions
CONNECT usr IDENTIFIED BY pwd [AT conn] USING src connect Connections and transactions
CONNECT USING src connect Connections and transactions
CONNECT RESET [conn], DISCONNECT [conn \| ALL] disconnect Connections and transactions
[AT conn] COMMIT [WORK] [RELEASE] commit Connections and transactions
[AT conn] ROLLBACK [WORK] [RELEASE] roll back Connections and transactions
[AT conn] ROLLBACK [WORK] TO SAVEPOINT name roll back to a savepoint Connections and transactions
[AT conn] SELECT ... INTO ... single-row query Embedded SQL statements
[AT conn] INSERT, UPDATE, DELETE data manipulation Embedded SQL statements
UPDATE, DELETE ... WHERE CURRENT OF cursor positioned update/delete Embedded SQL statements
[AT conn] OPEN cursor [USING ...] open a cursor Embedded SQL statements
FETCH cursor INTO ... fetch a row Embedded SQL statements
CLOSE cursor close a cursor Embedded SQL statements
[AT conn] PREPARE stmt FROM src prepare a statement Dynamic SQL
[AT conn] EXECUTE stmt [INTO ...] [USING ...] execute a prepared statement Dynamic SQL
[AT conn] EXECUTE IMMEDIATE src execute a dynamic statement Dynamic SQL
WHENEVER condition action error handling Error handling and diagnostics
IGNORE ... ignored by the precompiler
other statements passed unchanged to the database Embedded SQL statements
NoteTo be verified

Every line of this table against libgixpp/gix_esql_parser.yy, in particular DISCONNECT, DECLARE TABLE, IGNORE, and the statements that accept AT.