Developing Portable Applications : 2. Achieving Transparency and Portability : Supported Gateway Statements : DB2 UDB Statements
 
Share this page                  
DB2 UDB Statements
A DIRECT EXECUTE IMMEDIATE statement can return a status message or completion code, but cannot return data to the calling program. As a result, only DB2 UDB statements that do not return data can be used with a DIRECT EXECUTE IMMEDIATE statement.
The DIRECT EXECUTE IMMEDIATE statement allows you to use the DB2 UDB statements shown in the following list with the gateway.
Note:  This list is not exhaustive. Other statements may also work.
alter table
drop procedure
alter tablespace
drop synonym
comment on
drop tablespace
create database
explain
create global temporary table
grant (authorities)
create procedure
label on
create synonym
lock table
create tablespace
revoke
drop database
 
Note:  You must execute all DB2 UDB utilities directly on the host operating system because they are not available through the gateway.
The With Clause
The with clause enables you to specify DB2 UDB-specific options in an OpenSQL statement. The DB2 UDB gateway supports the with clause with the following OpenSQL statements:
connect
create index
create table
create view
Valid with clause options depend on the particular OpenSQL statement, as described in the following table:
With Clause Option
OpenSQL Statement
Description
check option
create view
Places restrictions on updating or inserting into a view. See the Ingres OpenSQL Reference Guide for more information.
db2_ct_option
connect
Allows you to specify one or more DB2-specific parameters to append to all subsequent create table statements in a given connection as shown in the example following this table.
db2_option
create index
create table
create view
Allows you to specify DB2-specific parameters.
On a create table statement you can specify either with db2_database or with db2_option, but not both.
You can issue this statement multiple times to specify multiple parameters.
Example: with clause option
To connect using the gwalias sample, setting the default table space for table creation to SAMPLEPC1:
EXEC SQL CONNECT 'win32::sample/db2udb with db2_ct_option = 'in SAMPLEPC1';