SQL/MX Comparison Guide for SQL/MP Users

Embedded SQL
HP NonStop SQL/MX Comparison Guide for SQL/MP Users523735-003
4-3
INVOKE Directive
INVOKE Directive
In NonStop SQL/MP, use the INVOKE directive interactively through SQLCI to create
host variable declarations in an EDIT file. The EDIT file can then be included in an
embedded SQL program.
In NonStop SQL/MX, use the INVOKE directive to create host variable declarations
only directly in an embedded SQL program. Use the INVOKE command in MXCI to
display the table and column names and data types associated with the columns; you
cannot invoke the format of another language (such as COBOL).
For either kind of table, INVOKE does not support the DATEFORMAT clause. INVOKE
returns the ANSI DATETIME data type. The SQL DATEFORMAT function returns a
character string. They are not compatible and cannot be used interchageably.
Data Type Conversion
For information about the valid conversions you can perform with CAST, see the
SQL/MX Reference Manual.
Host Variables With Date-time Data Types
In NonStop SQL/MX, you can convert data to the data type you specify by using the
CAST specification for any expression, whether or not you are using a parameter.
NonStop SQL/MX replaces the SQL/MP TYPE AS clause with the CAST specification.
In previous releases of NonStop SQL/MX, you were required to cast DATE, TIME,
TIMESTAMP, and INTERVAL data types. In NonStop SQL/MX Release 2.0 you can
directly declare them as host variables.
In NonStop SQL/MP, use the CAST function to associate a character or numeric data
type with a dynamic input parameter. Use the TYPE AS clause in the parameter
specification to associate a date-time or interval data type with a parameter.
Indicator Variables
As in NonStop SQL/MP, the primary use of the indicator variable in NonStop SQL/MX
is to indicate whether the value supplied is null. If the source value is null, the value of
the indicator variable is set to less than zero.
However, in NonStop SQL/MX, the indicator variable has another use. If an indicator
variable is associated with a target character host variable in the INTO clause of a
SELECT or FETCH statement, and the length of the target variable is smaller than the
value returned, the truncated string is placed into the host variable, the indicator
variable is set to the length of the source string, and a warning message is issued.
Otherwise, if the length of the target variable is sufficient, the indicator variable is set to
0.