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

SQL>/
SALARY
----------
175500.00
137000.10
139400.00
138000.40
75000.00
90000.00
118000.00
80000.00
70000.00
90000.00
56000.00
--- 11 row(s) selected.
For more information, see the “/ command” (page 57), “RUN command” (page 82), or “REPEAT
command” (page 80).
Preparing and executing SQL Statements
You can prepare or compile an SQL statement by using the prepare statement, and then you can
run the prepared SQL statement later by using the execute statement.
“Preparing an SQL Statement” (page 41)
“Setting parameters” (page 42)
“Displaying the parameters for the session” (page 42)
“Resetting the parameters” (page 43)
“Executing a prepared SQL statement” (page 43)
Preparing an SQL Statement
To compile an SQL statement for later execution, use the prepare statement. You can also use
the prepare statement to check the syntax of an SQL statement without executing the statement.
For example, the following statement compiles a SELECT statement named empsal and detects a
syntax error:
SQL>prepare empsal from
+>select salary from employee
+>where jobcode = 100;
SQL>*** ERROR[4082] Object JAVCAT.JAVSCH.EMPLOYEE does not exist or is
inaccessible. [2011-05-16 12:39:43]
*** ERROR[8822] The statement was not prepared. [2011-05-16 12:39:43]
You can then correct the syntax of the SQL statement and prepare it again:
SQL>prepare empsal from
+>select salary from persnl.employee
+>where jobcode = 100;
--- SQL command prepared.
Running SQL statements 41