SQL/MX Remote Conversational Interface (RMXCI) Guide for SQL/MX Release 3.1 (H06.23+, J06.12+)

75|TIM |WALKER |3000|300|320000.00
11|ROGER |GREEN |9000|100|175500.00
93|DONALD |TAYLOR |3100|300|33000.00
SET PARAM command
The set param command associates a parameter name with a parameter value in the current
session. The parameter name and value are associated with one of these parameter types:
Named parameter (represented by ?param-name) in a DML statement or in a prepared SQL
statement
Unnamed parameter (represented by ?) in a prepared SQL statement only
A prepared statement is one that you SQL compile by using the prepare statement. For more
information about prepare, see the SQL/MX Release 3.x Reference Manual.
After running set param commands in the session:
You can specify named parameters (?param-name) in a DML statement.
You can run a prepared statement with named parameters by using the execute statement
without a using clause.
You can run a prepared statement with unnamed parameters by using the execute command
with a using clause that contains either literal values or a list of the named parameters set
by set param command or both.
The execute statement substitutes parameter values for the parameters in the prepared statement.
For more information about execute, see the SQL/MX Release 3.x Reference Manual.
Syntax
SET PARAM param-name param-value
param-name
is the name of the parameter for which a value is specified. Parameter names are case-sensitive.
For example, the parameter ?pn is not equivalent to the parameter ?PN. param-name can
be preceded by a question mark (?), such as ?param-name.
param-value
is a numeric or character literal that specifies the value for the parameter. If you do not specify
a value, RMXCI returns an error.
If param-value is a character literal and the target column type is a character string, you do
not have to enclose the value in single quotation marks. Its data type is determined from the
data type of the column to which the literal is assigned. Character strings specified as parameter
values are always case-sensitive even if they are not enclosed in quotation marks.
Considerations
You must enter the command in one line.
Use separate set param commands to name and assign values to each unique parameter
in a prepared SQL statement before running the execute command.
Parameter names are case-sensitive. If you specify a parameter name in lowercase in the set
param command, you must specify it in lowercase in other statements, such as DML statements
or execute statement.
The named parameter (?param-name) in a DML statement must be identical to the parameter
name (param-name) that you specify in a set param command.
Examples
The following command sets a value for the ?sal parameter:
92 RMXCI commands