SQL/MX Comparison Guide for SQL/MP Users
HP NonStop SQL/MX Comparison Guide for SQL/MP Users—523735-003
4-1
4 Embedded SQL
As in NonStop SQL/MP, to access an SQL/MX database, you can execute SQL 
statements interactively by using MXCI (the NonStop SQL/MX equivalent to SQLCI) or 
programmatically by embedding, or including, SQL statements in a host program. In 
NonStop SQL/MX, you can write the host programs by using embedded SQL in the 
ANSI C, C++, COBOL, or Java programming languages.
This section discusses differences in the use of embedded SQL in C, C++, and 
COBOL programs between NonStop SQL/MP and NonStop SQL/MX. The main 
differences are in the diagnostics areas for error handling and in the descriptor areas 
for dynamic SQL programming. For detailed information about the use of embedded 
SQL in C, C++, and COBOL programs in NonStop SQL/MX, see the SQL/MX 
Programming Guide for C and COBOL. For information about embedding SQL/MX 
statements in Java programs, see the SQL/MX Programming Manual for Java. 
This section is organized into these categories:
Host Variable Declarations
Data Type Conversion
Host Variables With Date-time Data Types
Indicator Variables
Embedded SQL Statements
Dynamic SQL
Error Handling
Statistics Area
Program Development
Host Variable Declarations
NonStop SQL/MP allows the declaration of character host variables by using arithmetic 
operations to determine the size of the host variable array. NonStop SQL/MX does not 
allow arithmetic operations to determine the size of the array. In NonStop SQL/MX, 
host variables must have constants specifying the size of the array.
Many SQL/MP programs declare host variables from structures that are defined 
outside of the DECLARE SECTION. NonStop SQL/MX requires that structure 
definitions for host variables must be declared between BEGIN DECLARE SECTION 
and END DECLARE SECTION.
SETSCALE Function
In NonStop SQL/MP, using the C programming language, use the SETSCALE function 
to set the scale of certain data types. You must use the SETSCALE function whenever 
the host variable is used in the query. In NonStop SQL/MX, scale information for a host 
variable is supplied when the host variable is declared inside the BEGIN DECLARE 
SECTION. 










