Differences Between Embedded and Interactive OpenSQL
Embedded OpenSQL builds on the features and statements available in interactive OpenSQL. However, embedded OpenSQL differs from interactive OpenSQL in the following areas:
• Host language variables - Embedded OpenSQL allows host variables to be used in place of many syntactic elements. (There are no variables in interactive OpenSQL.)
• Error and status information - In interactive OpenSQL, error and status messages are sent directly to the terminal screen. In embedded OpenSQL, the SQL Communications Area (SQLCA) structure receives error and status information.
• Data manipulation statements - There are two embedded versions of the select statement. The first version is similar to the interactive select statement. The second version allows the retrieval and updating of an indeterminate number of rows, using cursors. The update and delete statements also have cursor versions. For more information about cursors, see Data Manipulation with Cursors in the chapter “Embedded OpenSQL.”
• Dynamic OpenSQL statements - Embedded OpenSQL creates statements dynamically from individual components specified in program variables. These statements can be executed repeatedly with different values.
• Additional database access statements - Embedded OpenSQL includes several statements not required in interactive OpenSQL. These additional statements enable your embedded application to connect to a database and to control cursors.
• Repeated queries - A repeated query executes more quickly than other queries, because the server retains the query execution plan. Embedded OpenSQL allows you to specify a select, insert, update, or delete statement as repeated.