SQL/MP Reference Manual
HP NonStop SQL/MP Reference Manual—523352-013
E-2
Embedded SQL
Embedded SQL
Embedded SQL, or programmatic SQL, is the application programming interface for
SQL. It consists of a set of SQL statements and declarations you can include in
programs written in C, COBOL, Pascal, or TAL.
The language in which you write an embedded SQL program is called the host
language or host programming language in SQL/MP documentation. A separate
SQL/MP programming manual exists for each of the four host languages supported by
NonStop SQL/MP. From each language you can also use the basic SQL statements
(but not the SQLCI commands) documented in this manual.
You can write embedded SQL programs that run as OSS processes or Guardian
processes in the host language C. Embedded SQL programs written in COBOL,
Pascal, or TAL must run as Guardian processes.
Embedded SQL programs communicate with SQL through host language variables
declared in an SQL declare section within the host language declare section and
through special SQL data structures called SQLCA, SQLDA, and SQLSA. Embedded
SQL programs declare and use cursors to process statements that return more than
one row of data; they can also use the SQL directive WHENEVER to test for exception
conditions.
An embedded SQL statement can be either static SQL (a statement coded directly into
the source code and compiled before the program execution) or dynamic SQL (a
statement built and compiled during the program execution).
For more information, see these entries:
Also, see the SQL/MP programming manual for the host programming language.
Dynamic SQL INCLUDE SQLCA
Directive
DECLARE CURSOR
Statement
Static SQL INCLUDE SQLDA
Directive
OPEN Statement
BEGIN DECLARE
SECTION Directive
INCLUDE SQLSA
Directive
FETCH Statement
END DECLARE
SECTION Directive
WHENEVER DIRECTIVE