Представление DOMAINS
Представление идентифицирует домены в данном каталоге, доступные данному пользователю. Представление определяется следующим образом:
CREATE VIEW DOMAINS AS SELECT DISTINCT DOMAIN_CATALOG, DOMAIN_SCHEMA, DOMAIN_NAME, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH, COLLATION_CATALOG, COLLATION_SCHEMA,COLLATION_NAME, CHARACTER_SET_CATALOG, CHARACTER_SET_SCHEMA, CHARACTER_SET_NAME, NUMERIC_PRECISION, NUMERIC_PRECISION_RADIX, NUMERIC_SCALE, DATETIME_PRECISION, DOMAIN_DEFAULT FROM DEFINITION_SCHEMA.DOMAINS JOIN DEFINITION_SCHEMA.DATA_TYPE_DESCRIPTOR AS D LEFT JOIN DEFINITION_SCHEMA.COLLATIONS AS S USING (COLLATION_CATALOG, COLLATION_SCHEMA, COLLATION_NAME) ON ((DOMAIN_CATALOG, DOMAIN_SCHEMA, DOMAIN_NAME, '') = (TABLE_OR_DOMAIN_CATALOG, TABLE_OR_DOMAIN_SCHEMA, TABLE_OR_DOMAIN_NAME, COLUMN_NAME)) WHERE ((DOMAIN_CATALOG, DOMAIN_SCHEMA, DOMAIN_NAME, 'DOMAIN') IN (SELECT OBJECT_CATALOG, OBJECT_SCHEMA, OBJECT_NAME, OBJECT_TYPE FROM DEFINITION_SCHEMA.USAGE_PRIVILEGES WHERE GRANTEE IN ('PUBLIC', CURRENT_USER)) OR (DOMAIN_CATALOG, DOMAIN_SCHEMA, DOMAIN_NAME) IN (SELECT DOMAIN_CATALOG, DOMAIN_SCHEMA, DOMAIN_NAME FROM COLUMNS)) AND DOMAIN_CATALOG = (SELECT CATALOG_NAME FROM INFORMATION_SCHEMA_CATALOG_NAME)