NonStop SQL/MP Reference Manual

Table Of Contents
NonStop SQL/MP Reference Manual142115
S-38
Examples—SET PARAM
Before you can execute the SELECT statement, you must specify the state and part
number with a SET PARAM command, as shown:
>> SET PARAM ?ST TEXAS, ?PN 4103;
>> OBEY FINDSUP2;
You do not have to enclose TEXAS in quotation marks because SQLCI determines
from the STATE column definition that the column has a character data type.
In the following examples, suppose that dates are in timestamp format and that the
OBEY command file INSORD contains the following commands:
INSERT INTO SALES.ORDERS
VALUES (?ONUM, ?TODAY, ?DDATE, ?REP, ?CUSTNUM);
To insert an order, set the order date to the current day and enter a specific delivery
date using the date conversion functions. The numbers of the order, sales
representative, and customer are entered as numeric literals:
>> SET PARAM ?ONUM 800661, ?TODAY CURRENT_TIMESTAMP,
+> ?DDATE COMPUTE_TIMESTAMP ( 5/23/1988 ),
+> ?REP 221, ?CUSTNUM 7654;
>> OBEY INSORD;
The following values are inserted in ORDERS:
Suppose you have set values for some of the parameters of the previous INSERT
command using the PARAM command before starting SQLCI:
4> PARAM ONUM 400410, CUSTNUM 7654
5> SQLCI
Before executing the INSORD OBEY file, you change the value of the order
number parameter and set values for the other parameters of the INSERT command:
>> SET PARAM ?ONUM 600480, ?TODAY CURRENT_TIMESTAMP,
+> ?DDATE COMPUTE_TIMESTAMP (7/5/1988), ?REP 221;
>> OBEY INSORD;
ORDERNUM 800661
ORDER_DAT
E
(timestamp for current date and time)
DELIV_DATE (timestamp for 5/23/88)
SALESREP 221
CUSTNUM 7654