SQL/MX 2.x Reference Manual (G06.24+, H06.03+)
MXCI Commands
HP NonStop SQL/MX Reference Manual—523725-004
4-48
Considerations for SET PARAM
Considerations for SET PARAM
Using With PREPARE and EXECUTE
If you use the PREPARE statement to compile an SQL statement, you must specify all
the parameters in the prepared SQL statement with the SET PARAM command prior to
issuing the EXECUTE statement.
Examples of SET PARAM
•
Set param ?x to ISO88591 string 'abc':
set param ?x _iso88591'abc'
or
set param ?x 'abc'
•
Set param ?y to UCS2 string 'abc':
set param ?y _ucs2'abc'
•
Set param ?z to KANJI string '1234':
set param ?z _kanji'1234'
•
Set param ?x to ISO88591 string 'abc':
set param ?x _iso88591 x'61 62 63'
•
Set param ?y to UCS2 string 'abc':
set param ?y _ucs2 x'0061 0062 0063'
•
Set param ?z to KANJI string '123':
set param ?z _kanji x'8250 8251 8253'
•
Suppose that SET PARAM commands are specified as:
SET PARAM ?ST 'TEXAS';
SET PARAM ?PN 3210;
Execute this query.
SELECT S.suppnum, suppname
FROM invent.supplier S,
invent.partsupp PS
WHERE S.suppnum = PS.suppnum AND
partnum = ?PN AND state = ?ST;
Supp/Num Supplier Name
-------- ------------------
15 DATADRIVE CORP
--- 1 row(s) selected.
You can set values for another state and part number and rerun the query.