The SQL statements you can use with nicknames
SQL statements support the use of nicknames.
| SQL statement | Description | Authorization required |
|---|---|---|
| ALTER NICKNAME | Modifies an existing nickname by changing the local column name, the local data type, the federated column options, or the informational constraints. The table or view at the data source is not affected. |
|
| ALTER TABLE | Changes a remote table that was created through the federated database by using transparent DDL. You cannot alter tables that were created natively on the data source. Can use informational constraints to add a referential integrity constraint to a nickname. |
|
| COMMENT ON | Adds or replaces comments in the catalog descriptions of various objects, including functions, function mappings, indexes, nicknames, servers, server options, type mappings, and wrappers. |
|
| CREATE ALIAS | Defines an alias for a nickname. |
|
| CREATE INDEX with SPECIFICATION ONLY clause | Creates an index specification (metadata) that indicates to the query optimizer that a data source object has an index. No actual index is created, only the specification is created. |
|
| CREATE TABLE with the OPTIONS clause | Creates a remote table through the federated database using transparent DDL. |
|
| CREATE TABLE with the AS fullselect and DATA INITIALLY DEFERRED REFRESH clauses | Creates a materialized query table using a fullselect that references a nickname. |
|
| CREATE VIEW | Creates a view that references one or more nicknames. |
|
| DELETE | Deletes rows from the data source object, such as a table or view that has a nickname. |
|
| DROP | Deletes an object, such as a nickname,
federated view, or index specification. The table, view, or index at the data
source is not affected. When the tables that are created by using the transparent DDL are dropped, the corresponding nickname for that table is also dropped. |
|
| GRANT | Grants privileges on nicknames and federated views, such as ALTER, DELETE, INDEX, INSERT, SELECT, or UPDATE. Privileges at the data source must be granted separately. |
|
| INSERT | Inserts rows into the data source object, such as a table or view that has a nickname. |
|
| LOCK TABLE | Causes the remote object at the data source to be locked. Prevents concurrent application processes from changing a data source table that has a nickname. |
|
| REVOKE | Revokes privileges on nicknames and federated views, such as ALTER, DELETE, INDEX, INSERT, SELECT, or UPDATE. Privileges at the data source must be revoked separately. |
|
| SELECT | Selects rows from the data source object, such as a table or view that has a nickname. |
|
| UPDATE | Updates the values in specified columns in rows in the data source object, such as a table or view that has a nickname. |
|
When you submit a query to the federated database, the authorization privileges for the nickname in the query are checked. The authorization requirements of the data source object that the nickname refers to are only applied when the query is processed at the data source.
To select, insert, update,
or delete data with a nickname, the authorization ID of the statement must
include these privileges:
- The appropriate privilege on the nickname for the federated database to accept the request
- The appropriate privilege on the underlying table object for the data source to accept the request