General rules

The embedded language is an SQL that is used in conjunction with a program SQL for creating an embedded UAP, declaring embedded variables, and declaring processing by means of return codes.

Table 6-1 shows the types and functions of the embedded language.

Table 6-1 Types and functions of the embedded language

TypeFunction
BEGIN DECLARE SECTION (Declare beginning of embedded SQL)Indicates the beginning of an embedded variables declaration section that specifies the embedded variables and indicator variables used in the SQL.
END DECLARE SECTION (Declare end of embedded SQL)Indicates the end of an embedded variables declaration section.
ALLOCATE CONNECTION HANDLE (Allocate connection handle)Allocates a connection handle to be used by a UAP in an environment where a multi-connection function is used.
FREE CONNECTION HANDLE (Release connection handle)Releases a connection handle that was allocated by ALLOCATE CONNECTION HANDLE.
DECLARE CONNECTION HANDLE SET (Declare connection handle to be used)Declares the connection handle to be used by a UAP in an environment where a multi-connection function is used.
DECLARE CONNECTION HANDLE UNSET (Reset all connection handles being used)Resets all declarations of connection handle usage specified in DECLARE CONNECTION HANDLE SET statements prior to this statement.
GET CONNECTION HANDLE (Get connection handles)Allocates the connection handle to be used by a UAP when the multi-connection facility is used under the X/Open XA interface environment.
COPY (Include library text)Includes (copies) a source library text into the source program.
GET DIAGNOSTICS (Retrieve diagnostic information)If the SQL statement that was executed immediately before is CREATE PROCEDURE, CREATE FUNCTION, CREATE TYPE, ALTER PROCEDURE, ALTER ROUTINE, ALTER TRIGGER, CREATE TRIGGER, a CALL statement, a dynamic SELECT statement with a WITH clause specification, or a cursor declaration, the statement acquires relevant error information and diagnostic information from the diagnostic area. If the SQL statement that was executed immediately before performs remote database access, the statement acquires error information that was returned by the distributed server.
COMMAND EXECUTE (Execute commands from UAP)Executes HiRDB and OS commands from within a UAP.
SQL prefixIndicates the beginning of an SQL.
SQL terminatorIndicates the end of an SQL.
WHENEVER (Declare embedded exception)Declares UAP processing, based on the return code set by HiRDB in the SQL Communications Area after an SQL has executed.
SQLCODE variableReceives a return code returned by HiRDB after an SQL has executed.
SQLSTATE variableReceives a return code returned by HiRDB after an SQL has executed.
PDCNCTHDL-type variable declarationDeclares the handle that has the connection information to be used in an environment where a multi-connection function is used.
INSTALL JARRegisters a JAR file in a HiRDB server.
REPLACE JARRe-registers a JAR file in a HiRDB server.
REMOVE JARDeletes a JAR file from a HiRDB server.