![]() Previous |
![]() Next |
The SQL EXECUTE command executes SQL statements that have been compiled using SQL PREPARE. Typically, the SQL statements that you precompile are statements that are executed repeatedly, particularly those involving OLAP DML input expressions, such as INSERT, UPDATE, and DELETE.
|
Note: The SQL PREPARE and SQL EXECUTE commands can only be used within the same DML program. |
Parameters
The name that you assigned to the executable code when you prepared it using SQL PREPARE.
Examples
Example 9-135 Updating a Relational Table Using Analytic Workspace Data
The next example shows a simple update of a table using data stored in Oracle OLAP. The market dimension is limited to one value at a time in the FOR loop. The SQL phrase WHERE s.market=:market specifies that the sales value in the row for that market is the value that is changed.
FOR market SQL UPDATE mkt SET sales=:mkt.sales WHERE s.market=:market
An UPDATE statement should be used in a SQL PREPARE statement and executed in a FOR loop.
SQL PREPARE s2 FROM UPDATE mkt -
SET sales=:mkt.sales WHERE s.market=:market
FOR market
DO
SQL EXECUTE s2
IF SQLCODE NE 0
THEN BREAK
DOEND