Release 10.1A: OpenEdge Data Management:
SQL Reference

> ## EXECUTE

> Executes the statement specified in statement_name.

> #### Syntax

>     EXECUTE statement_name
>       [ USING
>          { [ SQL ] DESCRIPTOR structure_name
>             | :host_variable [ [ INDICATOR ] :ind_variable ] , ... }
>       ] ;

> `statement_name`

> Name of the prepared SQL statement.

> `structure_name`

> Name of an SQL descriptor area (SQLDA).

> Example

>     /*
>     ** Process the non-SELECT input statement
>     **    PREPARE the statement
>     **    EXECUTE the prepared statement
>     **    COMMIT WORK
>     */
>           EXEC SQL PREPARE dynstmt FROM :sql_stmt_v ;
>           EXEC SQL EXECUTE dynstmt ;
>           EXEC SQL COMMIT WORK ;

> #### Notes

> - A statement must be processed with a `PREPARE` statement before it can be processed with an `EXECUTE` statement.

> - A prepared statement can be executed multiple times in the same transaction. Typically each call to the `EXECUTE` statement supplies a different set of host variables.

> - If there is no `DESCRIPTOR` in the `USING` clause, the `EXECUTE` statement is restricted to the number of variables specified in the host variable list. The number and type of the variables must be known at compile time. The host variables must be declared in the `DECLARE SECTION` before they can be used in the `USING` clause of the `EXECUTE` statement.

> - If there is a `DESCRIPTOR` in the `USING` clause, the program can allocate space for the input host variables at run time.

> ##### Related statements

> EXECUTE IMMEDIATE, PREPARE

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095