SQL/MX Remote Conversational Interface (RMXCI) Guide for SQL/MX Release 3.2 (H06.25+, J06.14+)
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 79), “RUN command” (page 105), or “REPEAT
command” (page 102).
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 62)
• “Setting parameters” (page 63)
• “Displaying the parameters for the session” (page 63)
• “Resetting the parameters” (page 64)
• “Executing a prepared SQL statement” (page 64)
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.
62 Interactively running commands in RMXCI










