EXECUTE Statement

Sends a DBMS-specific SQL statement to a DBMS that FedSQL supports.

Category: FedSQL Pass-through
Data source: Aster, DB2 under UNIX and PC, Greenplum, HDMD, Hive, MySQL, Netezza, ODBC, Oracle, PostgreSQL, SAP HANA, Sybase IQ, Teradata
See: Data Source Connection
FedSQL Pass-Through Facility
SQL documentation for your DBMS

Syntax

EXECUTE(native-syntax) BY catalog;

Arguments

native-syntax

specifies a native SQL query that can be run on the catalog’s driver. The EXECUTE statement accepts statements that produce a result set, as well as statements that do not produce a result set.

Restriction PROC FEDSQL does not support native syntax that contains embedded bare semicolons. You can, however, use the FedSQL language processor to run these statements.
Note The SQL statement might be case-sensitive, depending on your data source, and it is passed to the data source exactly as you enter it.

catalog

specifies the name of a catalog in the existing FedSQL connection.

Details

The EXECUTE statement is the only way that FedSQL provides to submit native SQL statements that do not produce a result set to a DBMS. Native SQL can be used in the following statements: DDLs, UPDATE, SELECT, and bulk loads.
A native connection for HDMD is a FedSQL connection.

Examples

Example 1: Using EXECUTE to Create and Drop a Table

execute(create table t_blob (col1 blob)) by saphana;
execute(drop table t_blob) by saphana;

Example 2: Using EXECUTE to Produce a Result Set

execute(select i, rank() over (order by j) rank from table_a ) by oracle;