SQL/MX 2.x Reference Manual (H06.04+)

SQL/MX Language Elements
HP NonStop SQL/MX Reference Manual540440-003
6-74
Working With MXCI Parameters
If the parameter is character and the target column has datetime data type, you
must CAST the parameter to have the same data type as the target column.
If the parameter is character or numeric and the target column has INTERVAL data
type, you must CAST the parameter to have the INTERVAL data type.
Working With MXCI Parameters
Use these statements with MXCI parameters:
Use of Parameter Names
Each occurrence of the same parameter name within an MXCI session refers to the
same parameter. The parameter has the value set by the most recent execution of a
SET PARAM statement. If no SET PARAM statement has been issued, the parameter
is undefined and NonStop SQL/MX returns an error message if you attempt to execute
a DML statement that uses the parameter name.
For example, during the execution of an INSERT statement, a parameter is assigned
the same attributes as the column into which the parameter's value is first inserted. If
NonStop SQL/MX truncates the parameter value to fit into the column, other
occurrences of the parameter also receive the truncated value, even if the columns for
those parameters are large enough to hold the entire value.
SET PARAM Command on
page 4-47
Sets the value of an MXCI-named parameter.
RESET PARAM Command
on
page 4-44
Clears all named parameter values or a specified named
parameter value.
SHOW PARAM Command
on
page 4-57
Displays all named parameters and their values that are
defined in the current MXCI session.
EXECUTE Statement
on
page 2-131
Executes an SQL statement previously compiled by the
PREPARE statement. You can specify values for unnamed
parameters in the SQL statement with the USING clause of
the EXECUTE statement.
PREPARE Statement
on
page 2-159
Compiles an SQL statement for later execution with
EXECUTE. The SQL statement might include named or
unnamed parameters.
Caution. If you use the same parameter name more than once in a single statement, do so
carefully to avoid the loss of data in certain cases. NonStop SQL/MX considers each reference
to point to the same parameter and assigns each occurrence the same data type and length as
the first occurrence.