GLOBAL_VARIABLES CREATE VIEW `GLOBAL_VARIABLES` AS SELECT `variable_name` as VARIABLE_NAME, `value` as VARIABLE_VALUE FROM oceanbase.__tenant_virtual_global_variable utf8mb4 utf8mb4_general_ci
KEY_COLUMN_USAGE CREATE VIEW `KEY_COLUMN_USAGE` AS (select /*+ READ_CONSISTENCY(WEAK) */ 'def' as CONSTRAINT_CATALOG, c.database_name as CONSTRAINT_SCHEMA, 'PRIMARY' as CONSTRAINT_NAME, 'def' as TABLE_CATALOG, c.database_name as TABLE_SCHEMA, a.table_name as TABLE_NAME, b.column_name as COLUMN_NAME, b.rowkey_position as ORDINAL_POSITION, NULL as POSITION_IN_UNIQUE_CONSTRAINT, NULL as REFERENCED_TABLE_SCHEMA, NULL as REFERENCED_TABLE_NAME, NULL as REFERENCED_COLUMN_NAME from oceanbase.__all_virtual_table a inner join oceanbase.__all_virtual_column b on a.table_id = b.table_id inner join oceanbase.__all_virtual_database c on a.database_id = c.database_id where a.tenant_id = effective_tenant_id() and b.tenant_id = effective_tenant_id() and c.tenant_id = effective_tenant_id() and c.in_recyclebin = 0 and c.database_name != '__recyclebin' and b.rowkey_position > 0 and b.column_id >= 16 and a.table_type != 5 and b.column_flags & (0x1 << 8) = 0) union (select /*+ READ_CONSISTENCY(WEAK) */ 'def' as CONSTRAINT_CATALOG, d.database_name as CONSTRAINT_SCHEMA, substr(a.table_name, 2 + length(substring_index(a.table_name,'_',4))) as CONSTRAINT_NAME, 'def' as TABLE_CATALOG, d.database_name as TABLE_SCHEMA, c.table_name as TABLE_NAME, b.column_name as COLUMN_NAME, b.index_position as ORDINAL_POSITION, NULL as POSITION_IN_UNIQUE_CONSTRAINT, NULL as REFERENCED_TABLE_SCHEMA, NULL as REFERENCED_TABLE_NAME, NULL as REFERENCED_COLUMN_NAME from oceanbase.__all_virtual_table a inner join oceanbase.__all_virtual_column b on a.table_id = b.table_id inner join oceanbase.__all_virtual_table c on a.data_table_id = c.table_id inner join oceanbase.__all_virtual_database d on c.database_id = d.database_id where a.tenant_id = effective_tenant_id() and b.tenant_id = effective_tenant_id() and c.tenant_id = effective_tenant_id() and d.in_recyclebin = 0 and d.tenant_id = effective_tenant_id() and d.database_name != '__recyclebin' and a.table_type = 5 and a.index_type in (2, 4, 8) and b.index_position > 0) utf8mb4 utf8mb4_general_ci
KEY_COLUMN_USAGE CREATE VIEW `KEY_COLUMN_USAGE` AS (select /*+ READ_CONSISTENCY(WEAK) */ 'def' as CONSTRAINT_CATALOG, c.database_name as CONSTRAINT_SCHEMA, 'PRIMARY' as CONSTRAINT_NAME, 'def' as TABLE_CATALOG, c.database_name as TABLE_SCHEMA, a.table_name as TABLE_NAME, b.column_name as COLUMN_NAME, b.rowkey_position as ORDINAL_POSITION, NULL as POSITION_IN_UNIQUE_CONSTRAINT, NULL as REFERENCED_TABLE_SCHEMA, NULL as REFERENCED_TABLE_NAME, NULL as REFERENCED_COLUMN_NAME from oceanbase.__all_virtual_table a inner join oceanbase.__all_virtual_column b on a.table_id = b.table_id inner join oceanbase.__all_virtual_database c on a.database_id = c.database_id where a.tenant_id = effective_tenant_id() and b.tenant_id = effective_tenant_id() and c.tenant_id = effective_tenant_id() and c.in_recyclebin = 0 and c.database_name != '__recyclebin' and b.rowkey_position > 0 and b.column_id >= 16 and a.table_type != 5 and b.column_flags & (0x1 << 8) = 0) union all (select /*+ READ_CONSISTENCY(WEAK) */ 'def' as CONSTRAINT_CATALOG, d.database_name as CONSTRAINT_SCHEMA, substr(a.table_name, 2 + length(substring_index(a.table_name,'_',4))) as CONSTRAINT_NAME, 'def' as TABLE_CATALOG, d.database_name as TABLE_SCHEMA, c.table_name as TABLE_NAME, b.column_name as COLUMN_NAME, b.index_position as ORDINAL_POSITION, NULL as POSITION_IN_UNIQUE_CONSTRAINT, NULL as REFERENCED_TABLE_SCHEMA, NULL as REFERENCED_TABLE_NAME, NULL as REFERENCED_COLUMN_NAME from oceanbase.__all_virtual_table a inner join oceanbase.__all_virtual_column b on a.table_id = b.table_id inner join oceanbase.__all_virtual_table c on a.data_table_id = c.table_id inner join oceanbase.__all_virtual_database d on c.database_id = d.database_id where a.tenant_id = effective_tenant_id() and b.tenant_id = effective_tenant_id() and c.tenant_id = effective_tenant_id() and d.in_recyclebin = 0 and d.tenant_id = effective_tenant_id() and d.database_name != '__recyclebin' and a.table_type = 5 and a.index_type in (2, 4, 8) and b.index_position > 0) union all (select /*+ READ_CONSISTENCY(WEAK) */ 'def' as CONSTRAINT_CATALOG, d.database_name as CONSTRAINT_SCHEMA, f.foreign_key_name as CONSTRAINT_NAME, 'def' as TABLE_CATALOG, d.database_name as TABLE_SCHEMA, t.table_name as TABLE_NAME, c.column_name as COLUMN_NAME, fc.position as ORDINAL_POSITION, NULL as POSITION_IN_UNIQUE_CONSTRAINT, /* POSITION_IN_UNIQUE_CONSTRAINT is not supported now */ d2.database_name as REFERENCED_TABLE_SCHEMA, t2.table_name as REFERENCED_TABLE_NAME, c2.column_name as REFERENCED_COLUMN_NAME from oceanbase.__all_virtual_foreign_key f inner join oceanbase.__all_virtual_table t on f.child_table_id = t.table_id inner join oceanbase.__all_virtual_database d on t.database_id = d.database_id inner join oceanbase.__all_virtual_foreign_key_column fc on f.foreign_key_id = fc.foreign_key_id inner join oceanbase.__all_virtual_column c on fc.child_column_id = c.column_id and t.table_id = c.table_id inner join oceanbase.__all_virtual_table t2 on f.parent_table_id = t2.table_id inner join oceanbase.__all_virtual_database d2 on t2.database_id = d2.database_id inner join oceanbase.__all_virtual_column c2 on fc.parent_column_id = c2.column_id and t2.table_id = c2.table_id where f.tenant_id = effective_tenant_id() and fc.tenant_id = effective_tenant_id() and t.tenant_id = effective_tenant_id() and d.tenant_id = effective_tenant_id() and c.tenant_id = effective_tenant_id() and t2.tenant_id = effective_tenant_id() and d2.tenant_id = effective_tenant_id() and c2.tenant_id = effective_tenant_id()) utf8mb4 utf8mb4_general_ci
SCHEMATA CREATE VIEW `SCHEMATA` AS SELECT 'def' AS CATALOG_NAME, DATABASE_NAME AS SCHEMA_NAME, 'utf8mb4' AS DEFAULT_CHARACTER_SET_NAME, 'utf8mb4_general_ci' AS DEFAULT_COLLATION_NAME, NULL AS SQL_PATH FROM oceanbase.__all_virtual_database a WHERE a.tenant_id = effective_tenant_id() and in_recyclebin = 0 and database_name != '__recyclebin' utf8mb4 utf8mb4_general_ci
SCHEMATA CREATE VIEW `SCHEMATA` AS SELECT 'def' AS CATALOG_NAME, DATABASE_NAME AS SCHEMA_NAME, 'utf8mb4' AS DEFAULT_CHARACTER_SET_NAME, 'utf8mb4_general_ci' AS DEFAULT_COLLATION_NAME, NULL AS SQL_PATH, 'NO' as DEFAULT_ENCRYPTION FROM oceanbase.__all_virtual_database a WHERE a.tenant_id = effective_tenant_id() and in_recyclebin = 0 and database_name != '__recyclebin' utf8mb4 utf8mb4_general_ci
TABLES CREATE VIEW `TABLES` AS select /*+ READ_CONSISTENCY(WEAK), use_merge(b, c, d, e)*/ 'def' as TABLE_CATALOG, b.database_name as TABLE_SCHEMA, a.table_name as TABLE_NAME, case when a.database_id & 0xFFFFFFFFFF = 2 then 'SYSTEM VIEW' when (a.table_type = 1 or a.table_type = 4) then 'VIEW' when a.table_type = 2 then 'SYSTEM TABLE' when a.table_type = 1 then 'INDEX' else 'BASE TABLE' end as TABLE_TYPE, NULL as ENGINE, NULL as VERSION, NULL as ROW_FORMAT, sum(c.row_count) as TABLE_ROWS, case when sum(c.row_count) = 0 then 0 else sum(c.data_size)/sum(c.row_count) end as AVG_ROW_LENGTH, sum(c.data_size) as DATA_LENGTH, NULL as MAX_DATA_LENGTH, NULL as INDEX_LENGTH, NULL as DATA_FREE, NULL as AUTO_INCREMENT, a.gmt_create as CREATE_TIME, a.gmt_modified as UPDATE_TIME, NULL as CHECK_TIME, d.collation as TABLE_COLLATION, cast(NULL as unsigned) as CHECKSUM, NULL as CREATE_OPTIONS, a.comment as TABLE_COMMENT from oceanbase.__all_virtual_table a inner join oceanbase.__all_virtual_database b on a.database_id = b.database_id left join oceanbase.__all_virtual_tenant_partition_meta_table c on a.table_id = c.table_id and c.tenant_id = effective_tenant_id() and a.tenant_id = c.tenant_id and c.role = 1 inner join oceanbase.__all_collation d on a.collation_type = d.id where a.tenant_id = effective_tenant_id() and b.tenant_id = effective_tenant_id() and a.table_type != 5 and b.database_name != '__recyclebin' and b.in_recyclebin = 0 group by a.table_id, b.database_name, a.table_name, a.table_type, a.gmt_create, a.gmt_modified, d.collation, a.comment utf8mb4 utf8mb4_general_ci
TABLES CREATE VIEW `TABLES` AS select /*+ READ_CONSISTENCY(WEAK), use_merge(b, c, d, e)*/ 'def' as TABLE_CATALOG, b.database_name as TABLE_SCHEMA, a.table_name as TABLE_NAME, case when a.database_id & 0xFFFFFFFFFF = 2 then 'SYSTEM VIEW' when (a.table_type = 1 or a.table_type = 4) then 'VIEW' when a.table_type = 2 then 'SYSTEM TABLE' when a.table_type = 1 then 'INDEX' else 'BASE TABLE' end as TABLE_TYPE, 'OceanBase' as ENGINE, NULL as VERSION, NULL as ROW_FORMAT, sum(c.row_count) as TABLE_ROWS, case when sum(c.row_count) = 0 then 0 else sum(c.data_size)/sum(c.row_count) end as AVG_ROW_LENGTH, sum(c.data_size) as DATA_LENGTH, NULL as MAX_DATA_LENGTH, NULL as INDEX_LENGTH, NULL as DATA_FREE, NULL as AUTO_INCREMENT, a.gmt_create as CREATE_TIME, a.gmt_modified as UPDATE_TIME, NULL as CHECK_TIME, d.collation as TABLE_COLLATION, cast(NULL as unsigned) as CHECKSUM, NULL as CREATE_OPTIONS, a.comment as TABLE_COMMENT from oceanbase.__all_virtual_table a inner join oceanbase.__all_virtual_database b on a.database_id = b.database_id left join oceanbase.__all_virtual_tenant_partition_meta_table c on a.table_id = c.table_id and c.tenant_id = effective_tenant_id() and a.tenant_id = c.tenant_id and c.role = 1 inner join oceanbase.__all_collation d on a.collation_type = d.id where a.tenant_id = effective_tenant_id() and b.tenant_id = effective_tenant_id() and a.table_type != 5 and b.database_name != '__recyclebin' and b.in_recyclebin = 0 and 0 = sys_privilege_check('table_acc', effective_tenant_id(), b.database_name, a.table_name) group by a.table_id, b.database_name, a.table_name, a.table_type, a.gmt_create, a.gmt_modified, d.collation, a.comment utf8mb4 utf8mb4_general_ci
VIEWS CREATE VIEW `VIEWS` AS select /*+ READ_CONSISTENCY(WEAK) */ 'def' AS TABLE_CATALOG, d.database_name as TABLE_SCHEMA, t.table_name as TABLE_NAME, t.view_definition as VIEW_DEFINITION, 'NONE' as CHECK_OPTION, case t.view_is_updatable when 1 then 'YES' else 'NO' end as IS_UPDATABLE, 'NONE' as DEFINER, 'NONE' AS SECURITY_TYPE, case t.collation_type when 45 then 'utf8mb4' else 'NONE' end AS CHARACTER_SET_CLIENT, case t.collation_type when 45 then 'utf8mb4_general_ci' else 'NONE' end AS COLLATION_CONNECTION from oceanbase.__all_virtual_table as t join oceanbase.__all_virtual_database as d on t.tenant_id = effective_tenant_id() and d.tenant_id = effective_tenant_id() and t.database_id = d.database_id where (t.table_type = 1 or t.table_type = 4) and d.in_recyclebin = 0 and d.database_name != '__recyclebin' and d.database_name != 'information_schema' and d.database_name != 'oceanbase' utf8mb4 utf8mb4_general_ci
VIEWS CREATE VIEW `VIEWS` AS select /*+ READ_CONSISTENCY(WEAK) */ 'def' AS TABLE_CATALOG, d.database_name as TABLE_SCHEMA, t.table_name as TABLE_NAME, t.view_definition as VIEW_DEFINITION, 'NONE' as CHECK_OPTION, case t.view_is_updatable when 1 then 'YES' else 'NO' end as IS_UPDATABLE, 'NONE' as DEFINER, 'NONE' AS SECURITY_TYPE, case t.collation_type when 45 then 'utf8mb4' else 'NONE' end AS CHARACTER_SET_CLIENT, case t.collation_type when 45 then 'utf8mb4_general_ci' else 'NONE' end AS COLLATION_CONNECTION from oceanbase.__all_virtual_table as t join oceanbase.__all_virtual_database as d on t.tenant_id = effective_tenant_id() and d.tenant_id = effective_tenant_id() and t.database_id = d.database_id where (t.table_type = 1 or t.table_type = 4) and d.in_recyclebin = 0 and d.database_name != '__recyclebin' and d.database_name != 'information_schema' and d.database_name != 'oceanbase' and 0 = sys_privilege_check('table_acc', effective_tenant_id(), d.database_name, t.table_name) utf8mb4 utf8mb4_general_ci
SCHEMATA CREATE VIEW `SCHEMATA` AS SELECT 'def' AS CATALOG_NAME, DATABASE_NAME AS SCHEMA_NAME, 'utf8mb4' AS DEFAULT_CHARACTER_SET_NAME, 'utf8mb4_general_ci' AS DEFAULT_COLLATION_NAME, NULL AS SQL_PATH FROM oceanbase.__all_virtual_database a WHERE a.tenant_id = effective_tenant_id() and in_recyclebin = 0 and database_name != '__recyclebin' utf8mb4 utf8mb4_general_ci
SCHEMATA CREATE VIEW `SCHEMATA` AS SELECT 'def' AS CATALOG_NAME, DATABASE_NAME AS SCHEMA_NAME, 'utf8mb4' AS DEFAULT_CHARACTER_SET_NAME, 'utf8mb4_general_ci' AS DEFAULT_COLLATION_NAME, NULL AS SQL_PATH, 'NO' as DEFAULT_ENCRYPTION FROM oceanbase.__all_virtual_database a WHERE a.tenant_id = effective_tenant_id() and in_recyclebin = 0 and database_name != '__recyclebin' utf8mb4 utf8mb4_general_ci
def SYS USER_TAB_PARTITIONS SELECT CAST(DB_TB.TABLE_NAME AS VARCHAR2(128)) TABLE_NAME, CAST(CASE WHEN PART.SUB_PART_NUM <=0 THEN 'NO' ELSE 'YES' END AS VARCHAR(3)) COMPOSITE, CAST(PART.PART_NAME AS VARCHAR(128)) PARTITION_NAME, CAST(PART.SUB_PART_NUM AS NUMBER) SUBPARTITION_COUNT, CAST(CASE WHEN length(PART.HIGH_BOUND_VAL) > 0 THEN PART.HIGH_BOUND_VAL ELSE PART.LIST_VAL END AS VARCHAR2(1024)) HIGH_VALUE, CAST(CASE WHEN length(PART.HIGH_BOUND_VAL) > 0 THEN length(PART.HIGH_BOUND_VAL) ELSE length(PART.LIST_VAL) END AS NUMBER) HIGH_VALUE_LENGTH, CAST(PART.PART_ID + 1 AS NUMBER) PARTITION_POSITION, CAST(TP.TABLESPACE_NAME AS VARCHAR2(30)) TABLESPACE_NAME, CAST(NULL AS NUMBER) PCT_FREE, CAST(NULL AS NUMBER) PCT_USED, CAST(NULL AS NUMBER) INI_TRANS, CAST(NULL AS NUMBER) MAX_TRANS, CAST(NULL AS NUMBER) INITIAL_EXTENT, CAST(NULL AS NUMBER) NEXT_EXTENT, CAST(NULL AS NUMBER) MIN_EXTENT, CAST(NULL AS NUMBER) MAX_EXTENT, CAST(NULL AS NUMBER) MAX_SIZE, CAST(NULL AS NUMBER) PCT_INCREASE, CAST(NULL AS NUMBER) FREELISTS, CAST(NULL AS NUMBER) FREELIST_GROUPS, CAST(NULL AS VARCHAR2(7)) LOGGING, CAST(CASE WHEN PART.COMPRESS_FUNC_NAME IS NULL THEN 'DISABLED' ELSE 'ENABLED' END AS VARCHAR2(8)) COMPRESSION, CAST(PART.COMPRESS_FUNC_NAME AS VARCHAR2(12)) COMPRESS_FOR, CAST(NULL AS NUMBER) NUM_ROWS, CAST(NULL AS NUMBER) BLOCKS, CAST(NULL AS NUMBER) EMPTY_BLOCKS, CAST(NULL AS NUMBER) AVG_SPACE, CAST(NULL AS NUMBER) CHAIN_CNT, CAST(NULL AS NUMBER) AVG_ROW_LEN, CAST(NULL AS NUMBER) SAMPLE_SIZE, CAST(NULL AS DATE) LAST_ANALYZED, CAST(NULL AS VARCHAR2(7)) BUFFER_POOL, CAST(NULL AS VARCHAR2(7)) FLASH_CACHE, CAST(NULL AS VARCHAR2(7)) CELL_FLASH_CACHE, CAST(NULL AS VARCHAR2(3)) GLOBAL_STATS, CAST(NULL AS VARCHAR2(3)) USER_STATS, CAST(NULL AS VARCHAR2(3)) IS_NESTED, CAST(NULL AS VARCHAR2(30)) PARENT_TABLE_PARTITION, CAST(NULL AS VARCHAR2(3)) "INTERVAL", CAST(NULL AS VARCHAR2(4)) SEGMENT_CREATED FROM (SELECT DB.DATABASE_NAME, DB.DATABASE_ID, TB.TABLE_ID, TB.TABLE_NAME FROM SYS.ALL_VIRTUAL_TABLE_REAL_AGENT TB, SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT DB WHERE TB.DATABASE_ID = DB.DATABASE_ID AND TB.TENANT_ID = EFFECTIVE_TENANT_ID() AND DB.TENANT_ID = EFFECTIVE_TENANT_ID()) DB_TB JOIN SYS.ALL_VIRTUAL_PART_REAL_AGENT PART ON DB_TB.TABLE_ID = PART.TABLE_ID AND PART.TENANT_ID = EFFECTIVE_TENANT_ID() AND DB_TB.DATABASE_NAME = SYS_CONTEXT('USERENV','CURRENT_USER') LEFT JOIN SYS.ALL_VIRTUAL_TENANT_TABLESPACE_REAL_AGENT TP ON TP.TABLESPACE_ID = PART.TABLESPACE_ID AND TP.TENANT_ID = EFFECTIVE_TENANT_ID() NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS USER_TAB_COMMENTS SELECT CAST(B.TABLE_NAME AS VARCHAR2(128)) AS TABLE_NAME, CAST(CASE WHEN TABLE_TYPE = 0 OR TABLE_TYPE = 2 OR TABLE_TYPE = 3 OR TABLE_TYPE = 5 OR TABLE_TYPE = 8 OR TABLE_TYPE = 9 THEN 'TABLE' WHEN TABLE_TYPE = 1 OR TABLE_TYPE = 4 OR TABLE_TYPE = 7 THEN 'VIEW' ELSE NULL END AS VARCHAR2(11)) AS TABLE_TYPE, CAST(B."COMMENT" AS VARCHAR(4000)) AS COMMENTS FROM SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT A JOIN SYS.ALL_VIRTUAL_TABLE_REAL_AGENT B ON A.DATABASE_ID = B.DATABASE_ID AND A.TENANT_ID = EFFECTIVE_TENANT_ID() AND B.TENANT_ID = EFFECTIVE_TENANT_ID() AND A.DATABASE_NAME = SYS_CONTEXT('USERENV','CURRENT_USER') NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS USER_TAB_COLS_V$ SELECT cast(t.table_name as VARCHAR2(128)) as TABLE_NAME, cast(c.column_name as VARCHAR2(128)) as COLUMN_NAME, cast(decode(c.data_type, 0, 'NULL', 1, 'NUMBER', 2, 'NUMBER', 3, 'NUMBER', 4, 'NUMBER', 5, 'NUMBER', 6, 'NUMBER', 7, 'NUMBER', 8, 'NUMBER', 9, 'NUMBER', 10, 'NUMBER', 11, 'BINARY_FLOAT', 12, 'BINARY_DOUBLE', 13, 'NUMBER', 14, 'NUMBER', 15, 'NUMBER', 16, 'NUMBER', 17, 'DATE', 18, 'TIMESTAMP', 19, 'DATE', 20, 'TIME', 21, 'YEAR', 22, 'VARCHAR2', 23, 'CHAR', 24, 'HEX_STRING', 25, 'EXT', 26, 'UNKNOWN', 27, 'TINYTEXT', 28, 'TEXT', 29, 'MEDIUMTEXT', 30, decode(c.collation_type, 63, 'BLOB', 'CLOB'), 31, 'BIT', 32, 'ENUM', 33, 'SET', 34, 'ENUM_INNER', 35, 'SET_INNER', 36, concat('TIMESTAMP(', concat(c.data_scale, ') WITH TIME ZONE')), 37, concat('TIMESTAMP(', concat(c.data_scale, ') WITH LOCAL TIME ZONE')), 38, concat('TIMESTAMP(', concat(c.data_scale, ')')), 39, 'RAW', 40, concat('INTERVAL YEAR(', concat(c.data_scale, ') TO MONTH')), 41, concat('INTERVAL DAY(', concat(trunc(c.data_scale/10), concat(') TO SECOND(', concat(mod(c.data_scale, 10), ')')))), 42, 'FLOAT', 43, 'NVARCHAR2', 44, 'NCHAR', 45, '', 'UNDEFINED') as VARCHAR2(128)) as DATA_TYPE, cast(NULL as VARCHAR2(3)) as DATA_TYPE_MOD, cast(NULL as VARCHAR2(128)) as DATA_TYPE_OWNER, cast(c.data_length as NUMBER) as DATA_LENGTH, cast(CASE WHEN c.data_type in (11,12,17,18,19,22,23,27,28,29,30,36,37,38,43,44) THEN NULL ELSE CASE WHEN c.data_precision < 0 THEN NULL ELSE c.data_precision END END as NUMBER) as DATA_PRECISION, cast(CASE WHEN c.data_type in (11,12,17,19,22,23,27,28,29,30,42,43,44) THEN NULL ELSE CASE WHEN c.data_scale < -84 THEN NULL ELSE c.data_scale END END as NUMBER) as DATA_SCALE, cast(decode(c.nullable, 1, 'Y', 'N') as VARCHAR2(1)) as NULLABLE, cast(decode(BITAND(c.column_flags, 64), 0, c.column_id, NULL) as NUMBER) as COLUMN_ID, cast(LENGTHB(c.cur_default_value_v2) as NUMBER) as DEFAULT_LENGTH, cast(c.cur_default_value_v2 as /* TODO: LONG() */ VARCHAR(128)) as DATA_DEFAULT, cast(NULL as NUMBER) as NUM_DISTINCT, cast(NULL as /* TODO: RAW */ varchar(128)) as LOW_VALUE, cast(NULL as /* TODO: RAW */ varchar(128)) as HIGH_VALUE, cast(NULL as NUMBER) as DENSITY, cast(NULL as NUMBER) as NUM_NULLS, cast(NULL as NUMBER) as NUM_BUCKETS, cast(NULL as DATE) as LAST_ANALYZED, cast(NULL as NUMBER) as SAMPLE_SIZE, cast(NULL as VARCHAR2(44)) as CHARACTER_SET_NAME, cast(NULL as NUMBER) as CHAR_COL_DECL_LENGTH, cast(NULL as VARCHAR2(3)) as GLOBAL_STATS, cast(NULL as VARCHAR2(3)) as USER_STATS, cast(NULL as VARCHAR2(80)) as NOTES, cast(NULL as NUMBER) as AVG_COL_LEN, cast(decode(c.data_type, 22, c.data_length, 23, c.data_length, 0) as NUMBER) as CHAR_LENGTH, cast(decode(c.data_type, 22, decode(c.data_precision, 1, 'C', 'B'), 23, decode(c.data_precision, 1, 'C', 'B'), NULL) as VARCHAR2(1)) as CHAR_USED, cast(NULL as VARCHAR2(3)) as V80_FMT_IMAGE, cast(NULL as VARCHAR2(3)) as DATA_UPGRADED, cast(decode(BITAND(c.column_flags, 64), 0, 'NO', 'YES') as VARCHAR2(3)) as HIDDEN_COLUMN, cast(decode(BITAND(c.column_flags, 1), 1, 'YES', 'NO') as VARCHAR2(3)) as VIRTUAL_COLUMN, cast(NULL as NUMBER) as SEGMENT_COLUMN_ID, cast(NULL as NUMBER) as INTERNAL_COLUMN_ID, cast(NULL as VARCHAR2(15)) as HISTOGRAM, cast(c.column_name as VARCHAR2(4000)) as QUALIFIED_COL_NAME, cast('YES' as VARCHAR2(3)) as USER_GENERATED, cast(NULL as VARCHAR2(3)) as DEFAULT_ON_NULL, cast(NULL as VARCHAR2(3)) as IDENTITY_COLUMN, cast(NULL as VARCHAR2(128)) as EVALUATION_EDITION, cast(NULL as VARCHAR2(128)) as UNUSABLE_BEFORE, cast(NULL as VARCHAR2(128)) as UNUSABLE_BEGINNING, cast(NULL as VARCHAR2(100)) as COLLATION, cast(NULL as NUMBER) as COLLATED_COLUMN_ID FROM sys.ALL_VIRTUAL_TABLE_REAL_AGENT t JOIN sys.ALL_VIRTUAL_COLUMN_REAL_AGENT c ON c.tenant_id = t.tenant_id AND c.table_id = t.table_id AND T.TENANT_ID = EFFECTIVE_TENANT_ID() AND C.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE c.is_hidden = 0 AND t.table_type in (0,2,3,8,9) AND t.database_id = USERENV('SCHEMAID') NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS USER_TAB_COLS_V$ SELECT cast(t.table_name as VARCHAR2(128)) as TABLE_NAME, cast(c.column_name as VARCHAR2(128)) as COLUMN_NAME, cast(decode(c.data_type, 0, 'NULL', 1, 'NUMBER', 2, 'NUMBER', 3, 'NUMBER', 4, 'NUMBER', 5, 'NUMBER', 6, 'NUMBER', 7, 'NUMBER', 8, 'NUMBER', 9, 'NUMBER', 10, 'NUMBER', 11, 'BINARY_FLOAT', 12, 'BINARY_DOUBLE', 13, 'NUMBER', 14, 'NUMBER', 15, 'NUMBER', 16, 'NUMBER', 17, 'DATE', 18, 'TIMESTAMP', 19, 'DATE', 20, 'TIME', 21, 'YEAR', 22, 'VARCHAR2', 23, 'CHAR', 24, 'HEX_STRING', 25, 'EXT', 26, 'UNKNOWN', 27, 'TINYTEXT', 28, 'TEXT', 29, 'MEDIUMTEXT', 30, decode(c.collation_type, 63, 'BLOB', 'CLOB'), 31, 'BIT', 32, 'ENUM', 33, 'SET', 34, 'ENUM_INNER', 35, 'SET_INNER', 36, concat('TIMESTAMP(', concat(c.data_scale, ') WITH TIME ZONE')), 37, concat('TIMESTAMP(', concat(c.data_scale, ') WITH LOCAL TIME ZONE')), 38, concat('TIMESTAMP(', concat(c.data_scale, ')')), 39, 'RAW', 40, concat('INTERVAL YEAR(', concat(c.data_scale, ') TO MONTH')), 41, concat('INTERVAL DAY(', concat(trunc(c.data_scale/10), concat(') TO SECOND(', concat(mod(c.data_scale, 10), ')')))), 42, 'FLOAT', 43, 'NVARCHAR2', 44, 'NCHAR', 45, '', 'UNDEFINED') as VARCHAR2(128)) as DATA_TYPE, cast(NULL as VARCHAR2(3)) as DATA_TYPE_MOD, cast(NULL as VARCHAR2(128)) as DATA_TYPE_OWNER, cast(c.data_length * CASE WHEN c.data_type in (22,23,30,43,44,46) and c.data_precision = 1 THEN decode(c.collation_type, 63, 1, 249, 4, 248, 4, 87, 2, 28, 2, 55, 4, 54, 4, 101, 2, 46, 4, 45, 4, 224, 4, 1) ELSE 1 END as NUMBER) as DATA_LENGTH, cast(CASE WHEN c.data_type in (11,12,17,18,19,22,23,27,28,29,30,36,37,38,43,44) THEN NULL ELSE CASE WHEN c.data_precision < 0 THEN NULL ELSE c.data_precision END END as NUMBER) as DATA_PRECISION, cast(CASE WHEN c.data_type in (11,12,17,19,22,23,27,28,29,30,42,43,44) THEN NULL ELSE CASE WHEN c.data_scale < -84 THEN NULL ELSE c.data_scale END END as NUMBER) as DATA_SCALE, cast(decode(c.nullable, 1, 'Y', 'N') as VARCHAR2(1)) as NULLABLE, cast(decode(BITAND(c.column_flags, 64), 0, c.column_id, NULL) as NUMBER) as COLUMN_ID, cast(LENGTHB(c.cur_default_value_v2) as NUMBER) as DEFAULT_LENGTH, cast(c.cur_default_value_v2 as /* TODO: LONG() */ VARCHAR(128)) as DATA_DEFAULT, cast(NULL as NUMBER) as NUM_DISTINCT, cast(NULL as /* TODO: RAW */ varchar(128)) as LOW_VALUE, cast(NULL as /* TODO: RAW */ varchar(128)) as HIGH_VALUE, cast(NULL as NUMBER) as DENSITY, cast(NULL as NUMBER) as NUM_NULLS, cast(NULL as NUMBER) as NUM_BUCKETS, cast(NULL as DATE) as LAST_ANALYZED, cast(NULL as NUMBER) as SAMPLE_SIZE, cast(decode(c.data_type, 22, 'CHAR_CS', 23, 'CHAR_CS', 30, decode(c.collation_type, 63, 'NULL', 'CHAR_CS'), 43, 'NCHAR_CS', 44, 'NCHAR_CS', '') as VARCHAR2(44)) as CHARACTER_SET_NAME, cast(NULL as NUMBER) as CHAR_COL_DECL_LENGTH, cast(NULL as VARCHAR2(3)) as GLOBAL_STATS, cast(NULL as VARCHAR2(3)) as USER_STATS, cast(NULL as VARCHAR2(80)) as NOTES, cast(NULL as NUMBER) as AVG_COL_LEN, cast(CASE WHEN c.data_type in (22,23,43,44) THEN c.data_length ELSE 0 END as NUMBER) as CHAR_LENGTH, cast(decode(c.data_type, 22, decode(c.data_precision, 1, 'C', 'B'), 23, decode(c.data_precision, 1, 'C', 'B'), 43, decode(c.data_precision, 1, 'C', 'B'), 44, decode(c.data_precision, 1, 'C', 'B'), NULL) as VARCHAR2(1)) as CHAR_USED, cast(NULL as VARCHAR2(3)) as V80_FMT_IMAGE, cast(NULL as VARCHAR2(3)) as DATA_UPGRADED, cast(decode(BITAND(c.column_flags, 64), 0, 'NO', 'YES') as VARCHAR2(3)) as HIDDEN_COLUMN, cast(decode(BITAND(c.column_flags, 1), 1, 'YES', 'NO') as VARCHAR2(3)) as VIRTUAL_COLUMN, cast(NULL as NUMBER) as SEGMENT_COLUMN_ID, cast(NULL as NUMBER) as INTERNAL_COLUMN_ID, cast(NULL as VARCHAR2(15)) as HISTOGRAM, cast(c.column_name as VARCHAR2(4000)) as QUALIFIED_COL_NAME, cast('YES' as VARCHAR2(3)) as USER_GENERATED, cast(NULL as VARCHAR2(3)) as DEFAULT_ON_NULL, cast(NULL as VARCHAR2(3)) as IDENTITY_COLUMN, cast(NULL as VARCHAR2(128)) as EVALUATION_EDITION, cast(NULL as VARCHAR2(128)) as UNUSABLE_BEFORE, cast(NULL as VARCHAR2(128)) as UNUSABLE_BEGINNING, cast(NULL as VARCHAR2(100)) as COLLATION, cast(NULL as NUMBER) as COLLATED_COLUMN_ID FROM sys.ALL_VIRTUAL_TABLE_REAL_AGENT t JOIN sys.ALL_VIRTUAL_COLUMN_REAL_AGENT c ON c.tenant_id = t.tenant_id AND c.table_id = t.table_id AND T.TENANT_ID = EFFECTIVE_TENANT_ID() AND C.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE c.is_hidden = 0 AND t.table_type in (0,2,3,8,9) AND t.database_id = USERENV('SCHEMAID') NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS USER_TABLESPACES SELECT TABLESPACE_NAME, CAST(NULL AS NUMBER) BLOCK_SIZE, CAST(NULL AS NUMBER) INITIAL_EXTENT, CAST(NULL AS NUMBER) NEXT_EXTENT, CAST(NULL AS NUMBER) MIN_EXTENT, CAST(NULL AS NUMBER) MAX_EXTENT, CAST(NULL AS NUMBER) MAX_SIZE, CAST(NULL AS NUMBER) PCT_INCREASE, CAST(NULL AS NUMBER) MIN_EXTLEN, CAST(NULL AS VARCHAR2(9)) STATUS, CAST(NULL AS VARCHAR2(9)) CONTENTS, CAST(NULL AS VARCHAR2(9)) LOGGING, CAST(NULL AS VARCHAR2(3)) FORCE_LOGGING, CAST(NULL AS VARCHAR2(10)) EXTENT_MANAGEMENT, CAST(NULL AS VARCHAR2(9)) ALLOCATION_TYPE, CAST(NULL AS VARCHAR2(6)) SEGMENT_SPACE_MANAGEMENT, CAST(NULL AS VARCHAR2(8)) DEF_TAB_COMPRESSION, CAST(NULL AS VARCHAR2(11)) RETENTION, CAST(NULL AS VARCHAR2(3)) BIGFILE, CAST(NULL AS VARCHAR2(7)) PREDICATE_EVALUATION, CAST(NULL AS VARCHAR2(3)) ENCRYPTED, CAST(NULL AS VARCHAR2(12)) COMPRESS_FOR FROM SYS.ALL_VIRTUAL_TENANT_TABLESPACE_REAL_AGENT WHERE TENANT_ID = EFFECTIVE_TENANT_ID() NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS USER_TABLES SELECT CAST(t.table_name AS VARCHAR2(128)) AS TABLE_NAME, CAST(tp.tablespace_name AS VARCHAR2(30)) AS TABLESPACE_NAME, CAST(NULL AS VARCHAR2(128)) AS CLUSTER_NAME, CAST(NULL AS VARCHAR2(128)) AS IOT_NAME, CAST('VALID' AS VARCHAR2(8)) AS STATUS, CAST(t."PCTFREE" AS NUMBER) AS PCT_FREE, CAST(NULL AS NUMBER) AS PCT_USED, CAST(NULL AS NUMBER) AS INI_TRANS, CAST(NULL AS NUMBER) AS MAX_TRANS, CAST(NULL AS NUMBER) AS INITIAL_EXTENT, CAST(NULL AS NUMBER) AS NEXT_EXTENT, CAST(NULL AS NUMBER) AS MIN_EXTENTS, CAST(NULL AS NUMBER) AS MAX_EXTENTS, CAST(NULL AS NUMBER) AS PCT_INCREASE, CAST(NULL AS NUMBER) AS FREELISTS, CAST(NULL AS NUMBER) AS FREELIST_GROUPS, CAST(NULL AS VARCHAR2(3)) AS LOGGING, CAST(NULL AS VARCHAR2(1)) AS BACKED_UP, CAST(info.row_count AS NUMBER) AS NUM_ROWS, CAST(NULL AS NUMBER) AS BLOCKS, CAST(NULL AS NUMBER) AS EMPTY_BLOCKS, CAST(NULL AS NUMBER) AS AVG_SPACE, CAST(NULL AS NUMBER) AS CHAIN_CNT, CAST(NULL AS NUMBER) AS AVG_ROW_LEN, CAST(NULL AS NUMBER) AS AVG_SPACE_FREELIST_BLOCKS, CAST(NULL AS NUMBER) AS NUM_FREELIST_BLOCKS, CAST(NULL AS VARCHAR2(40)) AS DEGREE, CAST(NULL AS VARCHAR2(40)) AS INSTANCES, CAST(NULL AS VARCHAR2(20)) AS CACHE, CAST(NULL AS VARCHAR2(8)) AS TABLE_LOCK, CAST(NULL AS NUMBER) AS SAMPLE_SIZE, CAST(NULL AS DATE) AS LAST_ANALYZED, CAST( CASE WHEN t.part_level = 0 THEN 'NO' ELSE 'YES' END AS VARCHAR2(3)) AS PARTITIONED, CAST(NULL AS VARCHAR2(12)) AS IOT_TYPE, CAST(decode (t.table_type, 8, 'YES', 9, 'YES', 'NO') AS VARCHAR2(1)) AS TEMPORARY, CAST(NULL AS VARCHAR2(1)) AS SECONDARY, CAST('NO' AS VARCHAR2(3)) AS NESTED, CAST(NULL AS VARCHAR2(7)) AS BUFFER_POOL, CAST(NULL AS VARCHAR2(7)) AS FLASH_CACHE, CAST(NULL AS VARCHAR2(7)) AS CELL_FLASH_CACHE, CAST(NULL AS VARCHAR2(8)) AS ROW_MOVEMENT, CAST(NULL AS VARCHAR2(3)) AS GLOBAL_STATS, CAST(NULL AS VARCHAR2(3)) AS USER_STATS, CAST( decode (t.table_type, 8, 'SYS$SESSION', 9, 'SYS$TRANSACTION', NULL) AS VARCHAR2(15)) AS DURATION, CAST(NULL AS VARCHAR2(8)) AS SKIP_CORRUPT, CAST(NULL AS VARCHAR2(3)) AS MONITORING, CAST(NULL AS VARCHAR2(30)) AS CLUSTER_OWNER, CAST(NULL AS VARCHAR2(8)) AS DEPENDENCIES, CAST(NULL AS VARCHAR2(8)) AS COMPRESSION, CAST(NULL AS VARCHAR2(12)) AS COMPRESS_FOR, CAST( CASE WHEN db.database_name = '__recyclebin' THEN 'YES' ELSE 'NO' END AS VARCHAR2(3)) AS DROPPED, CAST(NULL AS VARCHAR2(3)) AS READ_ONLY, CAST(NULL AS VARCHAR2(3)) AS SEGMENT_CREATED, CAST(NULL AS VARCHAR2(7)) AS RESULT_CACHE FROM ( SELECT tenant_id, table_id, SUM(row_count) AS row_count FROM sys.ALL_VIRTUAL_TENANT_PARTITION_META_TABLE_REAL_AGENT p WHERE p.role = 1 AND P.TENANT_ID = EFFECTIVE_TENANT_ID() GROUP BY tenant_id, table_id ) info RIGHT JOIN sys.ALL_VIRTUAL_TABLE_REAL_AGENT t ON t.tenant_id = info.tenant_id AND t.table_id = info.table_id AND T.TENANT_ID = EFFECTIVE_TENANT_ID() JOIN sys.ALL_VIRTUAL_DATABASE_REAL_AGENT db ON db.tenant_id = t.tenant_id AND db.database_id = t.database_id AND t.database_id = USERENV('SCHEMAID') AND t.table_type in (3, 8, 9, 11) AND DB.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN sys.ALL_VIRTUAL_TENANT_TABLESPACE_REAL_AGENT tp ON tp.tablespace_id = t.tablespace_id AND t.tenant_id = tp.tenant_id AND TP.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE t.session_id = 0 NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS USER_METHOD_PARAMS SELECT CAST(NULL AS VARCHAR2(30)) AS TYPE_NAME, CAST(NULL AS VARCHAR2(30)) AS METHOD_NAME, CAST(NULL AS NUMBER) AS METHOD_NO, CAST(NULL AS VARCHAR2(30)) AS PARAM_NAME, CAST(NULL AS NUMBER) AS PARAM_NO, CAST(NULL AS VARCHAR2(6)) AS PARAM_MODE, CAST(NULL AS VARCHAR2(7)) AS PARAM_TYPE_MOD, CAST(NULL AS VARCHAR2(30)) AS PARAM_TYPE_OWNER, CAST(NULL AS VARCHAR2(30)) AS PARAM_TYPE_NAME, CAST(NULL AS VARCHAR2(44)) AS CHARACTER_SET_NAME FROM DUAL WHERE 1 = 0 NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS USER_IND_SUBPARTITIONS SELECT CAST(B.INDEX_NAME AS VARCHAR2(128)) AS INDEX_NAME, CAST(PART.PART_NAME AS VARCHAR2(30)) AS PARTITION_NAME, CAST(SUB_PART.SUB_PART_NAME AS VARCHAR2(128)) AS SUBPARTITION_NAME, CAST(SUB_PART.HIGH_BOUND_VAL AS VARCHAR2(1024)) AS HIGH_VALUE, CAST(LENGTH(SUB_PART.HIGH_BOUND_VAL) AS NUMBER) AS HIGH_VALUE_LENGTH, SUB_PART.SUB_PART_ID + 1 AS SUBPARTITION_POSITION, CAST(NULL AS VARCHAR2(8)) AS STATUS, CAST(NULL AS VARCHAR2(30)) AS TABLESPACE_NAME, CAST(NULL AS NUMBER) AS PCT_FREE, CAST(NULL AS NUMBER) AS INI_TRANS, CAST(NULL AS NUMBER) AS MAX_TRANS, CAST(NULL AS NUMBER) AS INITIAL_EXTENT, CAST(NULL AS NUMBER) AS NEXT_EXTENT, CAST(NULL AS NUMBER) AS MIN_EXTENT, CAST(NULL AS NUMBER) AS MAX_EXTENT, CAST(NULL AS NUMBER) AS MAX_SIZE, CAST(NULL AS NUMBER) AS PCT_INCREASE, CAST(NULL AS NUMBER) AS FREELISTS, CAST(NULL AS NUMBER) AS FREELIST_GROUPS, CAST(NULL AS VARCHAR2(7)) AS LOGGING, CAST(CASE WHEN PART.COMPRESS_FUNC_NAME IS NULL THEN 'DISABLED' ELSE 'ENABLED' END AS VARCHAR2(8)) AS COMPRESSION, CAST(NULL AS NUMBER) AS BLEVEL, CAST(NULL AS NUMBER) AS LEAF_BLOCKS, CAST(NULL AS NUMBER) AS DISTINCT_KEYS, CAST(NULL AS NUMBER) AS AVG_LEAF_BLOCKS_PER_KEY, CAST(NULL AS NUMBER) AS AVG_DATA_BLOCKS_PER_KEY, CAST(NULL AS NUMBER) AS CLUSTERING_FACTOR, CAST(NULL AS NUMBER) AS NUM_ROWS, CAST(NULL AS NUMBER) AS SAMPLE_SIZE, CAST(NULL AS DATE) AS LAST_ANALYZED, CAST(NULL AS VARCHAR2(7)) AS BUFFER_POOL, CAST(NULL AS VARCHAR2(7)) AS FLASH_CACHE, CAST(NULL AS VARCHAR2(7)) AS CELL_FLASH_CACHE, CAST(NULL AS VARCHAR2(3)) AS USER_STATS, CAST(NULL AS NUMBER) AS PCT_DIRECT_ACCESS, CAST(NULL AS VARCHAR2(3)) AS GLOBAL_STATS, CAST(NULL AS VARCHAR2(6)) AS DOMIDX_OPSTATUS, CAST(NULL AS VARCHAR2(1000)) AS PARAMETERS, CAST(NULL AS VARCHAR2(3)) AS INTERVAL, CAST(NULL AS VARCHAR2(3)) AS SEGMENT_CREATED FROM( SELECT A.INDEX_OWNER AS INDEX_OWNER, A.INDEX_NAME AS INDEX_NAME, A.INDEX_TABLE_ID AS TABLE_ID, /*INDEX TABLE ID */ A.DATA_TABLE_ID AS DATA_TABLE_ID, A.PART_LEVEL AS INDEX_TABLE_PART_LEVEL, TB2.PART_LEVEL AS DATA_TABLE_PART_LEVEL, /* CAST(CASE WHEN A.PART_LEVEL=2 THEN 'FALSE' ELSE 'TRUE' END AS VARCHAR2(5)) IS_LOCAL */ CAST('TRUE' AS VARCHAR2(5)) AS IS_LOCAL FROM( SELECT DB.DATABASE_NAME AS INDEX_OWNER, SUBSTR(TB1.TABLE_NAME, 7 + INSTR(SUBSTR(TB1.TABLE_NAME, 7), '_')) AS INDEX_NAME, TB1.TABLE_ID AS INDEX_TABLE_ID, TB1.DATA_TABLE_ID AS DATA_TABLE_ID, TB1.INDEX_TYPE AS INDEX_TYPE, TB1.PART_LEVEL AS PART_LEVEL /*USE DATA TABLE'S PART_LEVEL IF INDEX IS LOCAL INDEX*/ FROM SYS.ALL_VIRTUAL_TABLE_REAL_AGENT TB1, SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT DB WHERE DB.DATABASE_NAME!='__recyclebin' AND TB1.DATABASE_ID=DB.DATABASE_ID AND TB1.TABLE_TYPE=5 AND TB1.TENANT_ID = EFFECTIVE_TENANT_ID() AND DB.TENANT_ID = EFFECTIVE_TENANT_ID() ) A JOIN SYS.ALL_VIRTUAL_TABLE_REAL_AGENT TB2 ON A.DATA_TABLE_ID=TB2.TABLE_ID AND TB2.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE A.PART_LEVEL=2 OR ((A.INDEX_TYPE=1 OR A.INDEX_TYPE=2) AND TB2.PART_LEVEL=2) ) B, SYS.ALL_VIRTUAL_PART_REAL_AGENT PART, SYS.ALL_VIRTUAL_SUB_PART_REAL_AGENT SUB_PART WHERE ((B.IS_LOCAL='FALSE' AND B.TABLE_ID=PART.TABLE_ID AND PART.TABLE_ID=SUB_PART.TABLE_ID AND PART.PART_ID=SUB_PART.PART_ID) OR (B.IS_LOCAL='TRUE' AND B.DATA_TABLE_ID=PART.TABLE_ID AND PART.TABLE_ID=SUB_PART.TABLE_ID AND PART.PART_ID=SUB_PART.PART_ID)) AND PART.TENANT_ID = EFFECTIVE_TENANT_ID() AND SUB_PART.TENANT_ID = EFFECTIVE_TENANT_ID() NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS USER_IND_PARTITIONS SELECT CAST(B.INDEX_NAME AS VARCHAR2(128)) AS INDEX_NAME, CAST(CASE WHEN PART.SUB_PART_NUM <=0 THEN 'NO' ELSE 'YES' END AS VARCHAR(3)) AS COMPOSITE, CAST(PART.PART_NAME AS VARCHAR2(128)) AS PARTITION_NAME, PART.SUB_PART_NUM AS SUBPARTITION_COUNT, CAST(PART.HIGH_BOUND_VAL AS VARCHAR2(1024)) AS HIGH_VALUE, CAST(LENGTH(PART.HIGH_BOUND_VAL) AS NUMBER) AS HIGH_VALUE_LENGTH, PART.PART_ID + 1 AS PARTITION_POSITION, CAST(NULL AS VARCHAR2(8)) AS STATUS, CAST(NULL AS VARCHAR2(30)) AS TABLESPACE_NAME, CAST(NULL AS NUMBER) AS PCT_FREE, CAST(NULL AS NUMBER) AS INI_TRANS, CAST(NULL AS NUMBER) AS MAX_TRANS, CAST(NULL AS NUMBER) AS INITIAL_EXTENT, CAST(NULL AS NUMBER) AS NEXT_EXTENT, CAST(NULL AS NUMBER) AS MIN_EXTENT, CAST(NULL AS NUMBER) AS MAX_EXTENT, CAST(NULL AS NUMBER) AS MAX_SIZE, CAST(NULL AS NUMBER) AS PCT_INCREASE, CAST(NULL AS NUMBER) AS FREELISTS, CAST(NULL AS NUMBER) AS FREELIST_GROUPS, CAST(NULL AS VARCHAR2(7)) AS LOGGING, CAST(CASE WHEN PART.COMPRESS_FUNC_NAME IS NULL THEN 'DISABLED' ELSE 'ENABLED' END AS VARCHAR2(8)) AS COMPRESSION, CAST(NULL AS NUMBER) AS BLEVEL, CAST(NULL AS NUMBER) AS LEAF_BLOCKS, CAST(NULL AS NUMBER) AS DISTINCT_KEYS, CAST(NULL AS NUMBER) AS AVG_LEAF_BLOCKS_PER_KEY, CAST(NULL AS NUMBER) AS AVG_DATA_BLOCKS_PER_KEY, CAST(NULL AS NUMBER) AS CLUSTERING_FACTOR, CAST(NULL AS NUMBER) AS NUM_ROWS, CAST(NULL AS NUMBER) AS SAMPLE_SIZE, CAST(NULL AS DATE) AS LAST_ANALYZED, CAST(NULL AS VARCHAR2(7)) AS BUFFER_POOL, CAST(NULL AS VARCHAR2(7)) AS FLASH_CACHE, CAST(NULL AS VARCHAR2(7)) AS CELL_FLASH_CACHE, CAST(NULL AS VARCHAR2(3)) AS USER_STATS, CAST(NULL AS NUMBER) AS PCT_DIRECT_ACCESS, CAST(NULL AS VARCHAR2(3)) AS GLOBAL_STATS, CAST(NULL AS VARCHAR2(6)) AS DOMIDX_OPSTATUS, CAST(NULL AS VARCHAR2(1000)) AS PARAMETERS, CAST(NULL AS VARCHAR2(3)) AS INTERVAL, CAST(NULL AS VARCHAR2(3)) AS SEGMENT_CREATED FROM( SELECT A.INDEX_OWNER AS INDEX_OWNER, A.INDEX_NAME AS INDEX_NAME, A.INDEX_TABLE_ID AS TABLE_ID, /*INDEX TABLE ID */ A.DATA_TABLE_ID AS DATA_TABLE_ID, CAST(CASE WHEN A.PART_LEVEL=1 THEN 'FALSE' ELSE 'TRUE' END AS VARCHAR2(5)) IS_LOCAL FROM( SELECT DB.DATABASE_NAME AS INDEX_OWNER, SUBSTR(TB1.TABLE_NAME, 7 + INSTR(SUBSTR(TB1.TABLE_NAME, 7), '_')) AS INDEX_NAME, TB1.TABLE_ID AS INDEX_TABLE_ID, TB1.DATA_TABLE_ID AS DATA_TABLE_ID, TB1.INDEX_TYPE AS INDEX_TYPE, TB1.PART_LEVEL AS PART_LEVEL /*USE DATA TABLE'S PART_LEVEL IF INDEX IS LOCAL INDEX*/ FROM SYS.ALL_VIRTUAL_TABLE_REAL_AGENT TB1, SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT DB WHERE DB.DATABASE_NAME!='__recyclebin' AND TB1.DATABASE_ID=DB.DATABASE_ID AND TB1.TABLE_TYPE=5 AND TB1.TENANT_ID = EFFECTIVE_TENANT_ID() AND DB.TENANT_ID = EFFECTIVE_TENANT_ID() ) A JOIN SYS.ALL_VIRTUAL_TABLE_REAL_AGENT TB2 ON A.DATA_TABLE_ID=TB2.TABLE_ID AND TB2.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE A.PART_LEVEL=1 OR ((A.INDEX_TYPE=1 OR A.INDEX_TYPE=2) AND TB2.PART_LEVEL=1) ) B JOIN SYS.ALL_VIRTUAL_PART_REAL_AGENT PART ON ((B.TABLE_ID=PART.TABLE_ID AND B.IS_LOCAL='FALSE') OR (B.DATA_TABLE_ID=PART.TABLE_ID AND B.IS_LOCAL='TRUE')) AND PART.TENANT_ID = EFFECTIVE_TENANT_ID() NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS USER_IND_EXPRESSIONS SELECT CAST(INDEX_NAME AS VARCHAR2(128)) AS INDEX_NAME, CAST(H.TABLE_NAME AS VARCHAR2(128)) AS TABLE_NAME, CAST(COLUMN_EXPRESSION /* TODO: LONG */ AS VARCHAR2(1000)) AS COLUMN_EXPRESSION, COLUMN_POSITION FROM ( SELECT INDEX_NAME, F.CUR_DEFAULT_VALUE_V2 AS COLUMN_EXPRESSION, E.INDEX_POSITION AS COLUMN_POSITION, E.TABLE_ID AS TABLE_ID FROM (SELECT INDEX_NAME, C.TABLE_ID AS TABLE_ID, C.INDEX_ID AS INDEX_ID, D.COLUMN_ID AS COLUMN_ID, D.COLUMN_NAME AS COLUMN_NAME, D.INDEX_POSITION AS INDEX_POSITION FROM (SELECT SUBSTR(TABLE_NAME, 7 + INSTR(SUBSTR(TABLE_NAME, 7), '_')) AS INDEX_NAME, A.DATA_TABLE_ID AS TABLE_ID, A.TABLE_ID AS INDEX_ID FROM SYS.ALL_VIRTUAL_TABLE_REAL_AGENT A JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT B ON A.DATABASE_ID = B.DATABASE_ID AND B.DATABASE_NAME != '__recyclebin' AND A.DATABASE_ID = USERENV('SCHEMAID') AND A.TENANT_ID = EFFECTIVE_TENANT_ID() AND B.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE TABLE_TYPE=5 ) C JOIN SYS.ALL_VIRTUAL_COLUMN_REAL_AGENT D ON C.INDEX_ID=D.TABLE_ID AND D.TENANT_ID = EFFECTIVE_TENANT_ID()) E JOIN SYS.ALL_VIRTUAL_COLUMN_REAL_AGENT F ON F.TABLE_ID=E.TABLE_ID AND F.TENANT_ID = EFFECTIVE_TENANT_ID() AND F.COLUMN_ID=E.COLUMN_ID AND F.COLUMN_FLAGS=1) G JOIN SYS.ALL_VIRTUAL_TABLE_REAL_AGENT H ON G.TABLE_ID=H.TABLE_ID AND H.TENANT_ID = EFFECTIVE_TENANT_ID() NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS USER_IND_EXPRESSIONS SELECT CAST(INDEX_NAME AS VARCHAR2(128)) AS INDEX_NAME, CAST(H.TABLE_NAME AS VARCHAR2(128)) AS TABLE_NAME, CAST(COLUMN_EXPRESSION /* TODO: LONG */ AS VARCHAR2(1000)) AS COLUMN_EXPRESSION, COLUMN_POSITION FROM ( SELECT INDEX_NAME, F.CUR_DEFAULT_VALUE_V2 AS COLUMN_EXPRESSION, E.INDEX_POSITION AS COLUMN_POSITION, E.TABLE_ID AS TABLE_ID FROM (SELECT INDEX_NAME, C.TABLE_ID AS TABLE_ID, C.INDEX_ID AS INDEX_ID, D.COLUMN_ID AS COLUMN_ID, D.COLUMN_NAME AS COLUMN_NAME, D.INDEX_POSITION AS INDEX_POSITION FROM (SELECT SUBSTR(TABLE_NAME, 7 + INSTR(SUBSTR(TABLE_NAME, 7), '_')) AS INDEX_NAME, A.DATA_TABLE_ID AS TABLE_ID, A.TABLE_ID AS INDEX_ID FROM SYS.ALL_VIRTUAL_TABLE_REAL_AGENT A JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT B ON A.DATABASE_ID = B.DATABASE_ID AND B.DATABASE_NAME != '__recyclebin' AND A.DATABASE_ID = USERENV('SCHEMAID') AND A.TENANT_ID = EFFECTIVE_TENANT_ID() AND B.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE TABLE_TYPE=5 ) C JOIN SYS.ALL_VIRTUAL_COLUMN_REAL_AGENT D ON C.INDEX_ID=D.TABLE_ID AND D.TENANT_ID = EFFECTIVE_TENANT_ID() AND D.INDEX_POSITION != 0) E JOIN SYS.ALL_VIRTUAL_COLUMN_REAL_AGENT F ON F.TABLE_ID=E.TABLE_ID AND F.TENANT_ID = EFFECTIVE_TENANT_ID() AND F.COLUMN_ID=E.COLUMN_ID AND BITAND(F.COLUMN_FLAGS,3) > 0) G JOIN SYS.ALL_VIRTUAL_TABLE_REAL_AGENT H ON G.TABLE_ID=H.TABLE_ID AND H.TENANT_ID = EFFECTIVE_TENANT_ID() NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS USER_IND_COLUMNS SELECT CAST(INDEX_NAME AS VARCHAR2(128)) AS INDEX_NAME, CAST(TABLE_NAME AS VARCHAR2(128)) AS TABLE_NAME, CAST(COLUMN_NAME AS VARCHAR2(4000)) AS COLUMN_NAME, CAST(ROWKEY_POSITION AS NUMBER) AS COLUMN_POSITION, CASE WHEN DATA_TYPE >= 1 AND DATA_TYPE <= 16 THEN CAST(22 AS NUMBER) WHEN DATA_TYPE = 17 THEN CAST(7 AS NUMBER) WHEN DATA_TYPE IN (22, 23) AND F.DATA_PRECISION = 2 THEN CAST(DATA_LENGTH AS NUMBER) WHEN DATA_TYPE IN (22, 23) AND F.DATA_PRECISION = 1 AND F.COLLATION_TYPE IN (45, 46, 224, 54, 55, 101) THEN CAST(DATA_LENGTH * 4 AS NUMBER) WHEN DATA_TYPE IN (22, 23) AND F.DATA_PRECISION = 1 AND F.COLLATION_TYPE IN (28, 87) THEN CAST(DATA_LENGTH * 2 AS NUMBER) WHEN DATA_TYPE = 36 THEN CAST(12 AS NUMBER) WHEN DATA_TYPE IN (37, 38) THEN CAST(11 AS NUMBER) WHEN DATA_TYPE = 39 THEN CAST(DATA_LENGTH AS NUMBER) WHEN DATA_TYPE = 40 THEN CAST(5 AS NUMBER) WHEN DATA_TYPE = 41 THEN CAST(11 AS NUMBER) ELSE CAST(0 AS NUMBER) END AS COLUMN_LENGTH, CASE WHEN DATA_TYPE IN (22, 23) THEN CAST(DATA_LENGTH AS NUMBER) ELSE CAST(0 AS NUMBER) END AS CHAR_LENGTH, CAST('ASC' AS VARCHAR2(4)) AS DESCEND FROM (SELECT INDEX_OWNER, INDEX_NAME, TABLE_OWNER, TABLE_NAME, INDEX_ID, IDX_TYPE FROM (SELECT DATABASE_NAME AS INDEX_OWNER, CASE WHEN (TABLE_TYPE = 5) THEN SUBSTR(TABLE_NAME, 7 + INSTR(SUBSTR(TABLE_NAME, 7), '_')) ELSE (CONS_TAB.CONSTRAINT_NAME) END AS INDEX_NAME, DATABASE_NAME AS TABLE_OWNER, CASE WHEN (TABLE_TYPE = 3) THEN A.TABLE_ID ELSE A.DATA_TABLE_ID END AS TABLE_ID, A.TABLE_ID AS INDEX_ID, TABLE_TYPE AS IDX_TYPE FROM SYS.ALL_VIRTUAL_TABLE_REAL_AGENT A JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT B ON A.DATABASE_ID = B.DATABASE_ID AND TABLE_TYPE IN (5, 3) AND A.DATABASE_ID = USERENV('SCHEMAID') AND B.DATABASE_NAME != '__recyclebin' AND A.TENANT_ID = EFFECTIVE_TENANT_ID() AND B.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_CONSTRAINT_REAL_AGENT CONS_TAB ON (CONS_TAB.TABLE_ID = A.TABLE_ID AND CONS_TAB.TENANT_ID = EFFECTIVE_TENANT_ID()) WHERE NOT( TABLE_TYPE = 3 AND CONSTRAINT_NAME IS NULL ) ) C JOIN SYS.ALL_VIRTUAL_TABLE_REAL_AGENT D ON C.TABLE_ID = D.TABLE_ID AND D.TENANT_ID = EFFECTIVE_TENANT_ID() ) E JOIN SYS.ALL_VIRTUAL_COLUMN_REAL_AGENT F ON E.INDEX_ID = F.TABLE_ID AND F.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE F.ROWKEY_POSITION != 0 AND (CASE WHEN IDX_TYPE = 5 THEN INDEX_POSITION ELSE 1 END) != 0 NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS USER_INDEXES SELECT CAST(INDEX_NAME AS VARCHAR2(128)) AS INDEX_NAME, CAST(INDEX_TYPE_NAME AS VARCHAR2(27)) AS INDEX_TYPE, CAST(TABLE_OWNER AS VARCHAR2(128)) AS TABLE_OWNER, CAST(TABLE_NAME AS VARCHAR2(128)) AS TABLE_NAME, CAST('TABLE' AS CHAR(5)) AS TABLE_TYPE, CAST(UNIQUENESS AS VARCHAR2(9)) AS UNIQUENESS, CAST(COMPRESSION AS VARCHAR2(8)) AS COMPRESSION, CAST(NULL AS NUMBER) AS PREFIX_LENGTH, CAST(TP.TABLESPACE_NAME AS VARCHAR2(30)) AS TABLESPACE_NAME, CAST(NULL AS NUMBER) AS INI_TRANS, CAST(NULL AS NUMBER) AS MAX_TRANS, CAST(NULL AS NUMBER) AS INITIAL_EXTENT, CAST(NULL AS NUMBER) AS NEXT_EXTENT, CAST(NULL AS NUMBER) AS MIN_EXTENTS, CAST(NULL AS NUMBER) AS MAX_EXTENTS, CAST(NULL AS NUMBER) AS PCT_INCREASE, CAST(NULL AS NUMBER) AS PCT_THRESHOLD, CAST(NULL AS NUMBER) AS INCLUDE_COLUMN, CAST(NULL AS NUMBER) AS FREELISTS, CAST(NULL AS NUMBER) AS FREELIST_GROUPS, CAST(NULL AS NUMBER) AS PCT_FREE, CAST(NULL AS VARCHAR2(3)) AS LOGGING, CAST(NULL AS NUMBER) AS BLEVEL, CAST(NULL AS NUMBER) AS LEAF_BLOCKS, CAST(NULL AS NUMBER) AS DISTINCT_KEYS, CAST(NULL AS NUMBER) AS AVG_LEAF_BLOCKS_PER_KEY, CAST(NULL AS NUMBER) AS AVG_DATA_BLOCKS_PER_KEY, CAST(NULL AS NUMBER) AS CLUSTERING_FACTOR, CAST(STATUS AS VARCHAR2(10)) AS STATUS, CAST(NULL AS NUMBER) AS NUM_ROWS, CAST(NULL AS NUMBER) AS SAMPLE_SIZE, CAST(NULL AS DATE) AS LAST_ANALYZED, CAST(NULL AS VARCHAR2(40)) AS DEGREE, CAST(NULL AS VARCHAR2(40)) AS INSTANCES, CAST(CASE WHEN A_TABLE_TYPE = 3 THEN 'NO' WHEN A_INDEX_TYPE = 1 OR A_INDEX_TYPE = 2 THEN (CASE WHEN D.PART_LEVEL = 0 THEN 'NO' ELSE 'YES' END) ELSE (CASE WHEN A_PART_LEVEL = 0 THEN 'NO' ELSE 'YES' END) END AS VARCHAR2(3)) AS PARTITIONED, CAST(NULL AS VARCHAR2(1)) AS TEMPORARY, CAST(NULL AS VARCHAR2(1)) AS "GENERATED", CAST(NULL AS VARCHAR2(1)) AS SECONDARY, CAST(NULL AS VARCHAR2(7)) AS BUFFER_POOL, CAST(NULL AS VARCHAR2(7)) AS FLASH_CACHE, CAST(NULL AS VARCHAR2(7)) AS CELL_FLASH_CACHE, CAST(NULL AS VARCHAR2(3)) AS USER_STATS, CAST(NULL AS VARCHAR2(15)) AS DURATION, CAST(NULL AS NUMBER) AS PCT_DIRECT_ACCESS, CAST(NULL AS VARCHAR2(30)) AS ITYP_OWNER, CAST(NULL AS VARCHAR2(30)) AS ITYP_NAME, CAST(NULL AS VARCHAR2(1000)) AS PARAMETERS, CAST(NULL AS VARCHAR2(3)) AS GLOBAL_STATS, CAST(NULL AS VARCHAR2(12)) AS DOMIDX_STATUS, CAST(NULL AS VARCHAR2(6)) AS DOMIDX_OPSTATUS, CAST(FUNCIDX_STATUS AS VARCHAR2(8)) AS FUNCIDX_STATUS, CAST('NO' AS VARCHAR2(3)) AS JOIN_INDEX, CAST(NULL AS VARCHAR2(3)) AS IOT_REDUNDANT_PKEY_ELIM, CAST(DROPPED AS VARCHAR2(9)) AS DROPPED, CAST(VISIBILITY AS VARCHAR2(10)) AS VISIBILITY, CAST(NULL AS VARCHAR2(14)) AS DOMIDX_MANAGEMENT, CAST(NULL AS VARCHAR2(3)) AS SEGMENT_CREATED FROM (SELECT DATABASE_NAME AS INDEX_OWNER, CASE WHEN (TABLE_TYPE = 5 AND B.DATABASE_NAME != '__recyclebin') THEN SUBSTR(TABLE_NAME, 7 + INSTR(SUBSTR(TABLE_NAME, 7), '_')) WHEN (TABLE_TYPE = 5 AND B.DATABASE_NAME = '__recyclebin') THEN TABLE_NAME ELSE (CONS_TAB.CONSTRAINT_NAME) END AS INDEX_NAME, CASE WHEN A.TABLE_TYPE = 5 AND EXISTS ( SELECT 1 FROM SYS.ALL_VIRTUAL_COLUMN_REAL_AGENT T_COL_INDEX, SYS.ALL_VIRTUAL_COLUMN_REAL_AGENT T_COL_BASE WHERE T_COL_BASE.TABLE_ID = A.DATA_TABLE_ID AND T_COL_BASE.COLUMN_NAME = T_COL_INDEX.COLUMN_NAME AND T_COL_INDEX.TABLE_ID = A.TABLE_ID AND T_COL_BASE.TENANT_ID = A.TENANT_ID AND T_COL_INDEX.TENANT_ID = A.TENANT_ID AND BITAND(T_COL_BASE.COLUMN_FLAGS,3) > 0 ) THEN 'FUNCTION-BASED NORMAL' ELSE 'NORMAL' END AS INDEX_TYPE_NAME, DATABASE_NAME AS TABLE_OWNER, CASE WHEN (TABLE_TYPE = 3) THEN A.TABLE_ID ELSE A.DATA_TABLE_ID END AS TABLE_ID, A.TABLE_ID AS INDEX_ID, CASE WHEN TABLE_TYPE = 3 THEN 'UNIQUE' WHEN A.INDEX_TYPE IN (2, 4, 8) THEN 'UNIQUE' ELSE 'NONUNIQUE' END AS UNIQUENESS, CASE WHEN A.COMPRESS_FUNC_NAME = NULL THEN 'DISABLED' ELSE 'ENABLED' END AS COMPRESSION, CASE WHEN TABLE_TYPE = 3 THEN 'VALID' WHEN A.INDEX_STATUS = 2 THEN 'VALID' WHEN A.INDEX_STATUS = 3 THEN 'CHECKING' WHEN A.INDEX_STATUS = 4 THEN 'INELEGIBLE' WHEN A.INDEX_STATUS = 5 THEN 'ERROR' ELSE 'UNUSABLE' END AS STATUS, A.INDEX_TYPE AS A_INDEX_TYPE, A.PART_LEVEL AS A_PART_LEVEL, A.TABLE_TYPE AS A_TABLE_TYPE, CASE WHEN 0 = (SELECT COUNT(1) FROM SYS.ALL_VIRTUAL_COLUMN_REAL_AGENT WHERE TABLE_ID = A.TABLE_ID AND IS_HIDDEN = 0 AND TENANT_ID = EFFECTIVE_TENANT_ID()) THEN 'ENABLED' ELSE 'NULL' END AS FUNCIDX_STATUS, CASE WHEN B.DATABASE_NAME = '__recyclebin' THEN 'YES' ELSE 'NO' END AS DROPPED, CASE WHEN BITAND(A.INDEX_ATTRIBUTES_SET, 1) = 0 THEN 'VISIBLE' ELSE 'INVISIBLE' END AS VISIBILITY, A.TABLESPACE_ID FROM SYS.ALL_VIRTUAL_TABLE_REAL_AGENT A JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT B ON A.DATABASE_ID = USERENV('SCHEMAID') AND A.DATABASE_ID = B.DATABASE_ID AND TABLE_TYPE IN (5, 3) AND A.TENANT_ID = EFFECTIVE_TENANT_ID() AND B.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_CONSTRAINT_REAL_AGENT CONS_TAB ON (CONS_TAB.TABLE_ID = A.TABLE_ID) AND CONS_TAB.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE NOT(TABLE_TYPE = 3 AND CONSTRAINT_NAME IS NULL) AND (CONS_TAB.CONSTRAINT_TYPE IS NULL OR CONS_TAB.CONSTRAINT_TYPE = 1) ) C JOIN SYS.ALL_VIRTUAL_TABLE_REAL_AGENT D ON C.TABLE_ID = D.TABLE_ID AND D.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_TENANT_TABLESPACE_REAL_AGENT TP ON C.TABLESPACE_ID = TP.TABLESPACE_ID AND TP.TENANT_ID = EFFECTIVE_TENANT_ID() NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS USER_ERRORS SELECT CAST(o.owner AS VARCHAR2(128)) AS OWNER, CAST(o.object_name AS VARCHAR2(128)) AS NAME, CAST(o.object_type AS VARCHAR2(19)) AS TYPE, CAST(e.obj_seq AS NUMBER) AS SEQUENCE, CAST(e.line AS NUMBER) AS LINE, CAST(e.position AS NUMBER) AS POSITION, CAST(e.text as VARCHAR2(4000)) AS TEXT, CAST(DECODE(e.property, 0, 'ERROR', 1, 'WARNING', 'UNDEFINED') AS VARCHAR2(9)) AS ATTRIBUTE, CAST(e.error_number AS NUMBER) AS MESSAGE_NUMBER FROM all_objects o, (select obj_id, obj_seq, line, position, text, property, error_number, CAST( UPPER(decode(obj_type, 3, 'PACKAGE', 4, 'TYPE', 5, 'PACKAGE BODY', 6, 'TYPE BODY', 7, 'TRIGGER', 8, 'VIEW', 9, 'FUNCTION', 12, 'PROCEDURE', 'MAXTYPE')) AS VARCHAR2(23)) object_type from sys.ALL_VIRTUAL_TENANT_ERROR_REAL_AGENT WHERE TENANT_ID = EFFECTIVE_TENANT_ID()) e, all_users u WHERE o.object_id = e.obj_id AND o.object_type like e.object_type AND o.object_type IN (UPPER('package'), UPPER('type'), UPPER('procedure'), UPPER('function'), UPPER('package body'), UPPER('view'), UPPER('trigger'), UPPER('type body'), UPPER('library'), UPPER('queue'), UPPER('java source'), UPPER('java class'), UPPER('dimension'), UPPER('assembly'), UPPER('hierarchy'), UPPER('arrtibute dimension'), UPPER('analytic view')) AND u.username=o.owner AND u.userid IN (USERENV('SCHEMAID')) NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS DBA_TAB_PARTITIONS SELECT CAST(DB_TB.DATABASE_NAME AS VARCHAR2(128)) TABLE_OWNER, CAST(DB_TB.TABLE_NAME AS VARCHAR2(128)) TABLE_NAME, CAST(CASE WHEN PART.SUB_PART_NUM <=0 THEN 'NO' ELSE 'YES' END AS VARCHAR(3)) COMPOSITE, CAST(PART.PART_NAME AS VARCHAR(128)) PARTITION_NAME, CAST(PART.SUB_PART_NUM AS NUMBER) SUBPARTITION_COUNT, CAST(CASE WHEN length(PART.HIGH_BOUND_VAL) > 0 THEN PART.HIGH_BOUND_VAL ELSE PART.LIST_VAL END AS VARCHAR2(1024)) HIGH_VALUE, CAST(CASE WHEN length(PART.HIGH_BOUND_VAL) > 0 THEN length(PART.HIGH_BOUND_VAL) ELSE length(PART.LIST_VAL) END AS NUMBER) HIGH_VALUE_LENGTH, CAST(PART.PART_ID + 1 AS NUMBER) PARTITION_POSITION, CAST(TP.TABLESPACE_NAME AS VARCHAR2(30)) TABLESPACE_NAME, CAST(NULL AS NUMBER) PCT_FREE, CAST(NULL AS NUMBER) PCT_USED, CAST(NULL AS NUMBER) INI_TRANS, CAST(NULL AS NUMBER) MAX_TRANS, CAST(NULL AS NUMBER) INITIAL_EXTENT, CAST(NULL AS NUMBER) NEXT_EXTENT, CAST(NULL AS NUMBER) MIN_EXTENT, CAST(NULL AS NUMBER) MAX_EXTENT, CAST(NULL AS NUMBER) MAX_SIZE, CAST(NULL AS NUMBER) PCT_INCREASE, CAST(NULL AS NUMBER) FREELISTS, CAST(NULL AS NUMBER) FREELIST_GROUPS, CAST(NULL AS VARCHAR2(7)) LOGGING, CAST(CASE WHEN PART.COMPRESS_FUNC_NAME IS NULL THEN 'DISABLED' ELSE 'ENABLED' END AS VARCHAR2(8)) COMPRESSION, CAST(PART.COMPRESS_FUNC_NAME AS VARCHAR2(12)) COMPRESS_FOR, CAST(NULL AS NUMBER) NUM_ROWS, CAST(NULL AS NUMBER) BLOCKS, CAST(NULL AS NUMBER) EMPTY_BLOCKS, CAST(NULL AS NUMBER) AVG_SPACE, CAST(NULL AS NUMBER) CHAIN_CNT, CAST(NULL AS NUMBER) AVG_ROW_LEN, CAST(NULL AS NUMBER) SAMPLE_SIZE, CAST(NULL AS DATE) LAST_ANALYZED, CAST(NULL AS VARCHAR2(7)) BUFFER_POOL, CAST(NULL AS VARCHAR2(7)) FLASH_CACHE, CAST(NULL AS VARCHAR2(7)) CELL_FLASH_CACHE, CAST(NULL AS VARCHAR2(3)) GLOBAL_STATS, CAST(NULL AS VARCHAR2(3)) USER_STATS, CAST(NULL AS VARCHAR2(3)) IS_NESTED, CAST(NULL AS VARCHAR2(30)) PARENT_TABLE_PARTITION, CAST(NULL AS VARCHAR2(3)) "INTERVAL", CAST(NULL AS VARCHAR2(4)) SEGMENT_CREATED FROM (SELECT DB.DATABASE_NAME, DB.DATABASE_ID, TB.TABLE_ID, TB.TABLE_NAME FROM SYS.ALL_VIRTUAL_TABLE_REAL_AGENT TB, SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT DB WHERE TB.DATABASE_ID = DB.DATABASE_ID AND TB.TENANT_ID = EFFECTIVE_TENANT_ID() AND DB.TENANT_ID = EFFECTIVE_TENANT_ID()) DB_TB JOIN SYS.ALL_VIRTUAL_PART_REAL_AGENT PART ON DB_TB.TABLE_ID = PART.TABLE_ID AND PART.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_TENANT_TABLESPACE_REAL_AGENT TP ON TP.TABLESPACE_ID = PART.TABLESPACE_ID AND TP.TENANT_ID = EFFECTIVE_TENANT_ID() NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS DBA_TAB_COMMENTS SELECT A.DATABASE_NAME AS OWNER, CAST(B.TABLE_NAME AS VARCHAR2(128)) AS TABLE_NAME, CAST(CASE WHEN TABLE_TYPE = 0 OR TABLE_TYPE = 2 OR TABLE_TYPE = 3 OR TABLE_TYPE = 5 OR TABLE_TYPE = 8 OR TABLE_TYPE = 9 THEN 'TABLE' WHEN TABLE_TYPE = 1 OR TABLE_TYPE = 4 OR TABLE_TYPE = 7 THEN 'VIEW' ELSE NULL END AS VARCHAR2(11)) AS TABLE_TYPE, CAST(B."COMMENT" AS VARCHAR(4000)) AS COMMENTS FROM SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT A JOIN SYS.ALL_VIRTUAL_TABLE_REAL_AGENT B ON A.DATABASE_ID = B.DATABASE_ID AND A.TENANT_ID = EFFECTIVE_TENANT_ID() AND B.TENANT_ID = EFFECTIVE_TENANT_ID() NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS DBA_TAB_COLS_V$ SELECT cast(db.database_name as VARCHAR2(128)) as OWNER, cast(t.table_name as VARCHAR2(128)) as TABLE_NAME, cast(c.column_name as VARCHAR2(128)) as COLUMN_NAME, cast(decode(c.data_type, 0, 'NULL', 1, 'NUMBER', 2, 'NUMBER', 3, 'NUMBER', 4, 'NUMBER', 5, 'NUMBER', 6, 'NUMBER', 7, 'NUMBER', 8, 'NUMBER', 9, 'NUMBER', 10, 'NUMBER', 11, 'BINARY_FLOAT', 12, 'BINARY_DOUBLE', 13, 'NUMBER', 14, 'NUMBER', 15, 'NUMBER', 16, 'NUMBER', 17, 'DATE', 18, 'TIMESTAMP', 19, 'DATE', 20, 'TIME', 21, 'YEAR', 22, 'VARCHAR2', 23, 'CHAR', 24, 'HEX_STRING', 25, 'EXT', 26, 'UNKNOWN', 27, 'TINYTEXT', 28, 'TEXT', 29, 'MEDIUMTEXT', 30, decode(c.collation_type, 63, 'BLOB', 'CLOB'), 31, 'BIT', 32, 'ENUM', 33, 'SET', 34, 'ENUM_INNER', 35, 'SET_INNER', 36, concat('TIMESTAMP(', concat(c.data_scale, ') WITH TIME ZONE')), 37, concat('TIMESTAMP(', concat(c.data_scale, ') WITH LOCAL TIME ZONE')), 38, concat('TIMESTAMP(', concat(c.data_scale, ')')), 39, 'RAW', 40, concat('INTERVAL YEAR(', concat(c.data_scale, ') TO MONTH')), 41, concat('INTERVAL DAY(', concat(trunc(c.data_scale/10), concat(') TO SECOND(', concat(mod(c.data_scale, 10), ')')))), 42, 'FLOAT', 43, 'NVARCHAR2', 44, 'NCHAR', 45, '', 'UNDEFINED') as VARCHAR2(128)) as DATA_TYPE, cast(NULL as VARCHAR2(3)) as DATA_TYPE_MOD, cast(NULL as VARCHAR2(128)) as DATA_TYPE_OWNER, cast(c.data_length as NUMBER) as DATA_LENGTH, cast(CASE WHEN c.data_type in (11,12,17,18,19,22,23,27,28,29,30,36,37,38,43,44) THEN NULL ELSE CASE WHEN c.data_precision < 0 THEN NULL ELSE c.data_precision END END as NUMBER) as DATA_PRECISION, cast(CASE WHEN c.data_type in (11,12,17,19,22,23,27,28,29,30,42,43,44) THEN NULL ELSE CASE WHEN c.data_scale < -84 THEN NULL ELSE c.data_scale END END as NUMBER) as DATA_SCALE, cast(decode(c.nullable, 1, 'Y', 'N') as VARCHAR2(1)) as NULLABLE, cast(decode(BITAND(c.column_flags, 64), 0, c.column_id, NULL) as NUMBER) as COLUMN_ID, cast(LENGTHB(c.cur_default_value_v2) as NUMBER) as DEFAULT_LENGTH, cast(c.cur_default_value_v2 as /* TODO: LONG() */ VARCHAR(128)) as DATA_DEFAULT, cast(NULL as NUMBER) as NUM_DISTINCT, cast(NULL as /* TODO: RAW */ varchar(128)) as LOW_VALUE, cast(NULL as /* TODO: RAW */ varchar(128)) as HIGH_VALUE, cast(NULL as NUMBER) as DENSITY, cast(NULL as NUMBER) as NUM_NULLS, cast(NULL as NUMBER) as NUM_BUCKETS, cast(NULL as DATE) as LAST_ANALYZED, cast(NULL as NUMBER) as SAMPLE_SIZE, cast(NULL as VARCHAR2(44)) as CHARACTER_SET_NAME, cast(NULL as NUMBER) as CHAR_COL_DECL_LENGTH, cast(NULL as VARCHAR2(3)) as GLOBAL_STATS, cast(NULL as VARCHAR2(3)) as USER_STATS, cast(NULL as VARCHAR2(80)) as NOTES, cast(NULL as NUMBER) as AVG_COL_LEN, cast(decode(c.data_type, 22, c.data_length, 23, c.data_length, 0) as NUMBER) as CHAR_LENGTH, cast(decode(c.data_type, 22, decode(c.data_precision, 1, 'C', 'B'), 23, decode(c.data_precision, 1, 'C', 'B'), NULL) as VARCHAR2(1)) as CHAR_USED, cast(NULL as VARCHAR2(3)) as V80_FMT_IMAGE, cast(NULL as VARCHAR2(3)) as DATA_UPGRADED, cast(decode(BITAND(c.column_flags, 64), 0, 'NO', 'YES') as VARCHAR2(3)) as HIDDEN_COLUMN, cast(decode(BITAND(c.column_flags, 1), 1, 'YES', 'NO') as VARCHAR2(3)) as VIRTUAL_COLUMN, cast(NULL as NUMBER) as SEGMENT_COLUMN_ID, cast(NULL as NUMBER) as INTERNAL_COLUMN_ID, cast(NULL as VARCHAR2(15)) as HISTOGRAM, cast(c.column_name as VARCHAR2(4000)) as QUALIFIED_COL_NAME, cast('YES' as VARCHAR2(3)) as USER_GENERATED, cast(NULL as VARCHAR2(3)) as DEFAULT_ON_NULL, cast(NULL as VARCHAR2(3)) as IDENTITY_COLUMN, cast(NULL as VARCHAR2(128)) as EVALUATION_EDITION, cast(NULL as VARCHAR2(128)) as UNUSABLE_BEFORE, cast(NULL as VARCHAR2(128)) as UNUSABLE_BEGINNING, cast(NULL as VARCHAR2(100)) as COLLATION, cast(NULL as NUMBER) as COLLATED_COLUMN_ID FROM sys.ALL_VIRTUAL_TABLE_REAL_AGENT t JOIN sys.ALL_VIRTUAL_DATABASE_REAL_AGENT db ON db.tenant_id = t.tenant_id AND db.database_id = t.database_id AND T.TENANT_ID = EFFECTIVE_TENANT_ID() AND DB.TENANT_ID = EFFECTIVE_TENANT_ID() JOIN sys.ALL_VIRTUAL_COLUMN_REAL_AGENT c ON c.tenant_id = t.tenant_id AND c.table_id = t.table_id AND C.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE c.is_hidden = 0 AND t.table_type in (0,2,3,8,9) NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS DBA_TAB_COLS_V$ SELECT cast(db.database_name as VARCHAR2(128)) as OWNER, cast(t.table_name as VARCHAR2(128)) as TABLE_NAME, cast(c.column_name as VARCHAR2(128)) as COLUMN_NAME, cast(decode(c.data_type, 0, 'NULL', 1, 'NUMBER', 2, 'NUMBER', 3, 'NUMBER', 4, 'NUMBER', 5, 'NUMBER', 6, 'NUMBER', 7, 'NUMBER', 8, 'NUMBER', 9, 'NUMBER', 10, 'NUMBER', 11, 'BINARY_FLOAT', 12, 'BINARY_DOUBLE', 13, 'NUMBER', 14, 'NUMBER', 15, 'NUMBER', 16, 'NUMBER', 17, 'DATE', 18, 'TIMESTAMP', 19, 'DATE', 20, 'TIME', 21, 'YEAR', 22, 'VARCHAR2', 23, 'CHAR', 24, 'HEX_STRING', 25, 'EXT', 26, 'UNKNOWN', 27, 'TINYTEXT', 28, 'TEXT', 29, 'MEDIUMTEXT', 30, decode(c.collation_type, 63, 'BLOB', 'CLOB'), 31, 'BIT', 32, 'ENUM', 33, 'SET', 34, 'ENUM_INNER', 35, 'SET_INNER', 36, concat('TIMESTAMP(', concat(c.data_scale, ') WITH TIME ZONE')), 37, concat('TIMESTAMP(', concat(c.data_scale, ') WITH LOCAL TIME ZONE')), 38, concat('TIMESTAMP(', concat(c.data_scale, ')')), 39, 'RAW', 40, concat('INTERVAL YEAR(', concat(c.data_scale, ') TO MONTH')), 41, concat('INTERVAL DAY(', concat(trunc(c.data_scale/10), concat(') TO SECOND(', concat(mod(c.data_scale, 10), ')')))), 42, 'FLOAT', 43, 'NVARCHAR2', 44, 'NCHAR', 45, '', 'UNDEFINED') as VARCHAR2(128)) as DATA_TYPE, cast(NULL as VARCHAR2(3)) as DATA_TYPE_MOD, cast(NULL as VARCHAR2(128)) as DATA_TYPE_OWNER, cast(c.data_length * CASE WHEN c.data_type in (22,23,30,43,44,46) and c.data_precision = 1 THEN decode(c.collation_type, 63, 1, 249, 4, 248, 4, 87, 2, 28, 2, 55, 4, 54, 4, 101, 2, 46, 4, 45, 4, 224, 4, 1) ELSE 1 END as NUMBER) as DATA_LENGTH, cast(CASE WHEN c.data_type in (11,12,17,18,19,22,23,27,28,29,30,36,37,38,43,44) THEN NULL ELSE CASE WHEN c.data_precision < 0 THEN NULL ELSE c.data_precision END END as NUMBER) as DATA_PRECISION, cast(CASE WHEN c.data_type in (11,12,17,19,22,23,27,28,29,30,42,43,44) THEN NULL ELSE CASE WHEN c.data_scale < -84 THEN NULL ELSE c.data_scale END END as NUMBER) as DATA_SCALE, cast(decode(c.nullable, 1, 'Y', 'N') as VARCHAR2(1)) as NULLABLE, cast(decode(BITAND(c.column_flags, 64), 0, c.column_id, NULL) as NUMBER) as COLUMN_ID, cast(LENGTHB(c.cur_default_value_v2) as NUMBER) as DEFAULT_LENGTH, cast(c.cur_default_value_v2 as /* TODO: LONG() */ VARCHAR(128)) as DATA_DEFAULT, cast(NULL as NUMBER) as NUM_DISTINCT, cast(NULL as /* TODO: RAW */ varchar(128)) as LOW_VALUE, cast(NULL as /* TODO: RAW */ varchar(128)) as HIGH_VALUE, cast(NULL as NUMBER) as DENSITY, cast(NULL as NUMBER) as NUM_NULLS, cast(NULL as NUMBER) as NUM_BUCKETS, cast(NULL as DATE) as LAST_ANALYZED, cast(NULL as NUMBER) as SAMPLE_SIZE, cast(decode(c.data_type, 22, 'CHAR_CS', 23, 'CHAR_CS', 30, decode(c.collation_type, 63, 'NULL', 'CHAR_CS'), 43, 'NCHAR_CS', 44, 'NCHAR_CS', '') as VARCHAR2(44)) as CHARACTER_SET_NAME, cast(NULL as NUMBER) as CHAR_COL_DECL_LENGTH, cast(NULL as VARCHAR2(3)) as GLOBAL_STATS, cast(NULL as VARCHAR2(3)) as USER_STATS, cast(NULL as VARCHAR2(80)) as NOTES, cast(NULL as NUMBER) as AVG_COL_LEN, cast(CASE WHEN c.data_type in (22,23,43,44) THEN c.data_length ELSE 0 END as NUMBER) as CHAR_LENGTH, cast(decode(c.data_type, 22, decode(c.data_precision, 1, 'C', 'B'), 23, decode(c.data_precision, 1, 'C', 'B'), 43, decode(c.data_precision, 1, 'C', 'B'), 44, decode(c.data_precision, 1, 'C', 'B'), NULL) as VARCHAR2(1)) as CHAR_USED, cast(NULL as VARCHAR2(3)) as V80_FMT_IMAGE, cast(NULL as VARCHAR2(3)) as DATA_UPGRADED, cast(decode(BITAND(c.column_flags, 64), 0, 'NO', 'YES') as VARCHAR2(3)) as HIDDEN_COLUMN, cast(decode(BITAND(c.column_flags, 1), 1, 'YES', 'NO') as VARCHAR2(3)) as VIRTUAL_COLUMN, cast(NULL as NUMBER) as SEGMENT_COLUMN_ID, cast(NULL as NUMBER) as INTERNAL_COLUMN_ID, cast(NULL as VARCHAR2(15)) as HISTOGRAM, cast(c.column_name as VARCHAR2(4000)) as QUALIFIED_COL_NAME, cast('YES' as VARCHAR2(3)) as USER_GENERATED, cast(NULL as VARCHAR2(3)) as DEFAULT_ON_NULL, cast(NULL as VARCHAR2(3)) as IDENTITY_COLUMN, cast(NULL as VARCHAR2(128)) as EVALUATION_EDITION, cast(NULL as VARCHAR2(128)) as UNUSABLE_BEFORE, cast(NULL as VARCHAR2(128)) as UNUSABLE_BEGINNING, cast(NULL as VARCHAR2(100)) as COLLATION, cast(NULL as NUMBER) as COLLATED_COLUMN_ID FROM sys.ALL_VIRTUAL_TABLE_REAL_AGENT t JOIN sys.ALL_VIRTUAL_DATABASE_REAL_AGENT db ON db.tenant_id = t.tenant_id AND db.database_id = t.database_id AND T.TENANT_ID = EFFECTIVE_TENANT_ID() AND DB.TENANT_ID = EFFECTIVE_TENANT_ID() JOIN sys.ALL_VIRTUAL_COLUMN_REAL_AGENT c ON c.tenant_id = t.tenant_id AND c.table_id = t.table_id AND C.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE c.is_hidden = 0 AND t.table_type in (0,2,3,8,9) NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS DBA_TABLESPACES SELECT TABLESPACE_NAME, CAST(NULL AS NUMBER) BLOCK_SIZE, CAST(NULL AS NUMBER) INITIAL_EXTENT, CAST(NULL AS NUMBER) NEXT_EXTENT, CAST(NULL AS NUMBER) MIN_EXTENT, CAST(NULL AS NUMBER) MAX_EXTENT, CAST(NULL AS NUMBER) MAX_SIZE, CAST(NULL AS NUMBER) PCT_INCREASE, CAST(NULL AS NUMBER) MIN_EXTLEN, CAST(NULL AS VARCHAR2(9)) STATUS, CAST(NULL AS VARCHAR2(9)) CONTENTS, CAST(NULL AS VARCHAR2(9)) LOGGING, CAST(NULL AS VARCHAR2(3)) FORCE_LOGGING, CAST(NULL AS VARCHAR2(10)) EXTENT_MANAGEMENT, CAST(NULL AS VARCHAR2(9)) ALLOCATION_TYPE, CAST(NULL AS VARCHAR2(3)) PLUGGED_IN, CAST(NULL AS VARCHAR2(6)) SEGMENT_SPACE_MANAGEMENT, CAST(NULL AS VARCHAR2(8)) DEF_TAB_COMPRESSION, CAST(NULL AS VARCHAR2(11)) RETENTION, CAST(NULL AS VARCHAR2(3)) BIGFILE, CAST(NULL AS VARCHAR2(7)) PREDICATE_EVALUATION, CAST(NULL AS VARCHAR2(3)) ENCRYPTED, CAST(NULL AS VARCHAR2(12)) COMPRESS_FOR FROM SYS.ALL_VIRTUAL_TENANT_TABLESPACE_REAL_AGENT WHERE TENANT_ID = EFFECTIVE_TENANT_ID() NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS DBA_TABLES SELECT CAST(db.database_name AS VARCHAR2(128)) AS OWNER, CAST(t.table_name AS VARCHAR2(128)) AS TABLE_NAME, CAST(tp.tablespace_name AS VARCHAR2(30)) AS TABLESPACE_NAME, CAST(NULL AS VARCHAR2(128)) AS CLUSTER_NAME, CAST(NULL AS VARCHAR2(128)) AS IOT_NAME, CAST('VALID' AS VARCHAR2(8)) AS STATUS, CAST(t."PCTFREE" AS NUMBER) AS PCT_FREE, CAST(NULL AS NUMBER) AS PCT_USED, CAST(NULL AS NUMBER) AS INI_TRANS, CAST(NULL AS NUMBER) AS MAX_TRANS, CAST(NULL AS NUMBER) AS INITIAL_EXTENT, CAST(NULL AS NUMBER) AS NEXT_EXTENT, CAST(NULL AS NUMBER) AS MIN_EXTENTS, CAST(NULL AS NUMBER) AS MAX_EXTENTS, CAST(NULL AS NUMBER) AS PCT_INCREASE, CAST(NULL AS NUMBER) AS FREELISTS, CAST(NULL AS NUMBER) AS FREELIST_GROUPS, CAST(NULL AS VARCHAR2(3)) AS LOGGING, CAST(NULL AS VARCHAR2(1)) AS BACKED_UP, CAST(info.row_count AS NUMBER) AS NUM_ROWS, CAST(NULL AS NUMBER) AS BLOCKS, CAST(NULL AS NUMBER) AS EMPTY_BLOCKS, CAST(NULL AS NUMBER) AS AVG_SPACE, CAST(NULL AS NUMBER) AS CHAIN_CNT, CAST(NULL AS NUMBER) AS AVG_ROW_LEN, CAST(NULL AS NUMBER) AS AVG_SPACE_FREELIST_BLOCKS, CAST(NULL AS NUMBER) AS NUM_FREELIST_BLOCKS, CAST(NULL AS VARCHAR2(40)) AS DEGREE, CAST(NULL AS VARCHAR2(40)) AS INSTANCES, CAST(NULL AS VARCHAR2(20)) AS CACHE, CAST(NULL AS VARCHAR2(8)) AS TABLE_LOCK, CAST(NULL AS NUMBER) AS SAMPLE_SIZE, CAST(NULL AS DATE) AS LAST_ANALYZED, CAST( CASE WHEN t.part_level = 0 THEN 'NO' ELSE 'YES' END AS VARCHAR2(3)) AS PARTITIONED, CAST(NULL AS VARCHAR2(12)) AS IOT_TYPE, CAST(decode (t.table_type, 8, 'YES', 9, 'YES', 'NO') AS VARCHAR2(1)) AS TEMPORARY, CAST(NULL AS VARCHAR2(1)) AS SECONDARY, CAST('NO' AS VARCHAR2(3)) AS NESTED, CAST(NULL AS VARCHAR2(7)) AS BUFFER_POOL, CAST(NULL AS VARCHAR2(7)) AS FLASH_CACHE, CAST(NULL AS VARCHAR2(7)) AS CELL_FLASH_CACHE, CAST(NULL AS VARCHAR2(8)) AS ROW_MOVEMENT, CAST(NULL AS VARCHAR2(3)) AS GLOBAL_STATS, CAST(NULL AS VARCHAR2(3)) AS USER_STATS, CAST( decode (t.table_type, 8, 'SYS$SESSION', 9, 'SYS$TRANSACTION', NULL) AS VARCHAR2(15)) AS DURATION, CAST(NULL AS VARCHAR2(8)) AS SKIP_CORRUPT, CAST(NULL AS VARCHAR2(3)) AS MONITORING, CAST(NULL AS VARCHAR2(30)) AS CLUSTER_OWNER, CAST(NULL AS VARCHAR2(8)) AS DEPENDENCIES, CAST(NULL AS VARCHAR2(8)) AS COMPRESSION, CAST(NULL AS VARCHAR2(12)) AS COMPRESS_FOR, CAST( CASE WHEN db.database_name = '__recyclebin' THEN 'YES' ELSE 'NO' END AS VARCHAR2(3)) AS DROPPED, CAST(NULL AS VARCHAR2(3)) AS READ_ONLY, CAST(NULL AS VARCHAR2(3)) AS SEGMENT_CREATED, CAST(NULL AS VARCHAR2(7)) AS RESULT_CACHE FROM ( SELECT tenant_id, table_id, SUM(row_count) AS row_count FROM sys.ALL_VIRTUAL_TENANT_PARTITION_META_TABLE_REAL_AGENT p WHERE p.role = 1 AND P.TENANT_ID = EFFECTIVE_TENANT_ID() GROUP BY tenant_id, table_id ) info RIGHT JOIN sys.ALL_VIRTUAL_TABLE_REAL_AGENT t ON t.tenant_id = info.tenant_id AND t.table_id = info.table_id JOIN sys.ALL_VIRTUAL_DATABASE_REAL_AGENT db ON db.tenant_id = t.tenant_id AND db.database_id = t.database_id AND db.database_name != '__recyclebin' AND t.table_type in (3, 8, 9, 11) AND DB.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN sys.ALL_VIRTUAL_TENANT_TABLESPACE_REAL_AGENT tp ON tp.tablespace_id = t.tablespace_id AND t.tenant_id = tp.tenant_id AND TP.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE t.session_id = 0 NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS DBA_METHOD_PARAMS SELECT CAST(NULL AS VARCHAR2(30)) AS OWNER, CAST(NULL AS VARCHAR2(30)) AS TYPE_NAME, CAST(NULL AS VARCHAR2(30)) AS METHOD_NAME, CAST(NULL AS NUMBER) AS METHOD_NO, CAST(NULL AS VARCHAR2(30)) AS PARAM_NAME, CAST(NULL AS NUMBER) AS PARAM_NO, CAST(NULL AS VARCHAR2(6)) AS PARAM_MODE, CAST(NULL AS VARCHAR2(7)) AS PARAM_TYPE_MOD, CAST(NULL AS VARCHAR2(30)) AS PARAM_TYPE_OWNER, CAST(NULL AS VARCHAR2(30)) AS PARAM_TYPE_NAME, CAST(NULL AS VARCHAR2(44)) AS CHARACTER_SET_NAME FROM DUAL WHERE 1 = 0 NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS DBA_IND_SUBPARTITIONS SELECT CAST(B.INDEX_OWNER AS VARCHAR2(128)) AS INDEX_OWNER, CAST(B.INDEX_NAME AS VARCHAR2(128)) AS INDEX_NAME, CAST(PART.PART_NAME AS VARCHAR2(128)) AS PARTITION_NAME, CAST(SUB_PART.SUB_PART_NAME AS VARCHAR2(128)) AS SUBPARTITION_NAME, CAST(SUB_PART.HIGH_BOUND_VAL AS VARCHAR2(1024)) AS HIGH_VALUE, CAST(LENGTH(SUB_PART.HIGH_BOUND_VAL) AS NUMBER) AS HIGH_VALUE_LENGTH, SUB_PART.SUB_PART_ID + 1 AS SUBPARTITION_POSITION, CAST(NULL AS VARCHAR2(8)) AS STATUS, CAST(NULL AS VARCHAR2(30)) AS TABLESPACE_NAME, CAST(NULL AS NUMBER) AS PCT_FREE, CAST(NULL AS NUMBER) AS INI_TRANS, CAST(NULL AS NUMBER) AS MAX_TRANS, CAST(NULL AS NUMBER) AS INITIAL_EXTENT, CAST(NULL AS NUMBER) AS NEXT_EXTENT, CAST(NULL AS NUMBER) AS MIN_EXTENT, CAST(NULL AS NUMBER) AS MAX_EXTENT, CAST(NULL AS NUMBER) AS MAX_SIZE, CAST(NULL AS NUMBER) AS PCT_INCREASE, CAST(NULL AS NUMBER) AS FREELISTS, CAST(NULL AS NUMBER) AS FREELIST_GROUPS, CAST(NULL AS VARCHAR2(7)) AS LOGGING, CAST(CASE WHEN PART.COMPRESS_FUNC_NAME IS NULL THEN 'DISABLED' ELSE 'ENABLED' END AS VARCHAR2(8)) AS COMPRESSION, CAST(NULL AS NUMBER) AS BLEVEL, CAST(NULL AS NUMBER) AS LEAF_BLOCKS, CAST(NULL AS NUMBER) AS DISTINCT_KEYS, CAST(NULL AS NUMBER) AS AVG_LEAF_BLOCKS_PER_KEY, CAST(NULL AS NUMBER) AS AVG_DATA_BLOCKS_PER_KEY, CAST(NULL AS NUMBER) AS CLUSTERING_FACTOR, CAST(NULL AS NUMBER) AS NUM_ROWS, CAST(NULL AS NUMBER) AS SAMPLE_SIZE, CAST(NULL AS DATE) AS LAST_ANALYZED, CAST(NULL AS VARCHAR2(7)) AS BUFFER_POOL, CAST(NULL AS VARCHAR2(7)) AS FLASH_CACHE, CAST(NULL AS VARCHAR2(7)) AS CELL_FLASH_CACHE, CAST(NULL AS VARCHAR2(3)) AS USER_STATS, CAST(NULL AS NUMBER) AS PCT_DIRECT_ACCESS, CAST(NULL AS VARCHAR2(3)) AS GLOBAL_STATS, CAST(NULL AS VARCHAR2(6)) AS DOMIDX_OPSTATUS, CAST(NULL AS VARCHAR2(1000)) AS PARAMETERS, CAST(NULL AS VARCHAR2(3)) AS INTERVAL, CAST(NULL AS VARCHAR2(3)) AS SEGMENT_CREATED FROM( SELECT A.INDEX_OWNER AS INDEX_OWNER, A.INDEX_NAME AS INDEX_NAME, A.INDEX_TABLE_ID AS TABLE_ID, /*INDEX TABLE ID*/ A.DATA_TABLE_ID AS DATA_TABLE_ID, A.PART_LEVEL AS INDEX_TABLE_PART_LEVEL, TB2.PART_LEVEL AS DATA_TABLE_PART_LEVEL, /* CAST(CASE WHEN A.PART_LEVEL=2 THEN 'FALSE' ELSE 'TRUE' END AS VARCHAR2(5)) IS_LOCAL */ CAST('TRUE' AS VARCHAR2(5)) AS IS_LOCAL FROM( SELECT DB.DATABASE_NAME AS INDEX_OWNER, SUBSTR(TB1.TABLE_NAME, 7 + INSTR(SUBSTR(TB1.TABLE_NAME, 7), '_')) AS INDEX_NAME, TB1.TABLE_ID AS INDEX_TABLE_ID, TB1.DATA_TABLE_ID AS DATA_TABLE_ID, TB1.INDEX_TYPE AS INDEX_TYPE, TB1.PART_LEVEL AS PART_LEVEL /*USE DATA TABLE'S PART_LEVEL IF INDEX IS LOCAL INDEX*/ FROM SYS.ALL_VIRTUAL_TABLE_REAL_AGENT TB1, SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT DB WHERE DB.DATABASE_NAME!='__recyclebin' AND TB1.DATABASE_ID=DB.DATABASE_ID AND TB1.TABLE_TYPE=5 AND TB1.TENANT_ID = EFFECTIVE_TENANT_ID() AND DB.TENANT_ID = EFFECTIVE_TENANT_ID() ) A JOIN SYS.ALL_VIRTUAL_TABLE_REAL_AGENT TB2 ON A.DATA_TABLE_ID=TB2.TABLE_ID AND TB2.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE A.PART_LEVEL=2 OR ((A.INDEX_TYPE=1 OR A.INDEX_TYPE=2) AND TB2.PART_LEVEL=2) ) B, SYS.ALL_VIRTUAL_PART_REAL_AGENT PART, SYS.ALL_VIRTUAL_SUB_PART_REAL_AGENT SUB_PART WHERE ((B.IS_LOCAL='FALSE' AND B.TABLE_ID=PART.TABLE_ID AND PART.TABLE_ID=SUB_PART.TABLE_ID AND PART.PART_ID=SUB_PART.PART_ID) OR (B.IS_LOCAL='TRUE' AND B.DATA_TABLE_ID=PART.TABLE_ID AND PART.TABLE_ID=SUB_PART.TABLE_ID AND PART.PART_ID=SUB_PART.PART_ID)) AND SUB_PART.TENANT_ID = EFFECTIVE_TENANT_ID() AND PART.TENANT_ID = EFFECTIVE_TENANT_ID() NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS DBA_IND_PARTITIONS SELECT CAST(B.INDEX_OWNER AS VARCHAR2(128)) AS INDEX_OWNER, CAST(B.INDEX_NAME AS VARCHAR2(128)) AS INDEX_NAME, CAST(CASE WHEN PART.SUB_PART_NUM <=0 THEN 'NO' ELSE 'YES' END AS VARCHAR(3)) AS COMPOSITE, CAST(PART.PART_NAME AS VARCHAR2(128)) AS PARTITION_NAME, PART.SUB_PART_NUM AS SUBPARTITION_COUNT, CAST(PART.HIGH_BOUND_VAL AS VARCHAR2(1024)) AS HIGH_VALUE, CAST(LENGTH(PART.HIGH_BOUND_VAL) AS NUMBER) AS HIGH_VALUE_LENGTH, PART.PART_ID + 1 AS PARTITION_POSITION, CAST(NULL AS VARCHAR2(8)) AS STATUS, CAST(NULL AS VARCHAR2(30)) AS TABLESPACE_NAME, CAST(NULL AS NUMBER) AS PCT_FREE, CAST(NULL AS NUMBER) AS INI_TRANS, CAST(NULL AS NUMBER) AS MAX_TRANS, CAST(NULL AS NUMBER) AS INITIAL_EXTENT, CAST(NULL AS NUMBER) AS NEXT_EXTENT, CAST(NULL AS NUMBER) AS MIN_EXTENT, CAST(NULL AS NUMBER) AS MAX_EXTENT, CAST(NULL AS NUMBER) AS MAX_SIZE, CAST(NULL AS NUMBER) AS PCT_INCREASE, CAST(NULL AS NUMBER) AS FREELISTS, CAST(NULL AS NUMBER) AS FREELIST_GROUPS, CAST(NULL AS VARCHAR2(7)) AS LOGGING, CAST(CASE WHEN PART.COMPRESS_FUNC_NAME IS NULL THEN 'DISABLED' ELSE 'ENABLED' END AS VARCHAR2(8)) AS COMPRESSION, CAST(NULL AS NUMBER) AS BLEVEL, CAST(NULL AS NUMBER) AS LEAF_BLOCKS, CAST(NULL AS NUMBER) AS DISTINCT_KEYS, CAST(NULL AS NUMBER) AS AVG_LEAF_BLOCKS_PER_KEY, CAST(NULL AS NUMBER) AS AVG_DATA_BLOCKS_PER_KEY, CAST(NULL AS NUMBER) AS CLUSTERING_FACTOR, CAST(NULL AS NUMBER) AS NUM_ROWS, CAST(NULL AS NUMBER) AS SAMPLE_SIZE, CAST(NULL AS DATE) AS LAST_ANALYZED, CAST(NULL AS VARCHAR2(7)) AS BUFFER_POOL, CAST(NULL AS VARCHAR2(7)) AS FLASH_CACHE, CAST(NULL AS VARCHAR2(7)) AS CELL_FLASH_CACHE, CAST(NULL AS VARCHAR2(3)) AS USER_STATS, CAST(NULL AS NUMBER) AS PCT_DIRECT_ACCESS, CAST(NULL AS VARCHAR2(3)) AS GLOBAL_STATS, CAST(NULL AS VARCHAR2(6)) AS DOMIDX_OPSTATUS, CAST(NULL AS VARCHAR2(1000)) AS PARAMETERS, CAST(NULL AS VARCHAR2(3)) AS INTERVAL, CAST(NULL AS VARCHAR2(3)) AS SEGMENT_CREATED FROM( SELECT A.INDEX_OWNER AS INDEX_OWNER, A.INDEX_NAME AS INDEX_NAME, A.INDEX_TABLE_ID AS TABLE_ID, /*INDEX TABLE ID*/ A.DATA_TABLE_ID AS DATA_TABLE_ID, CAST(CASE WHEN A.PART_LEVEL=1 THEN 'FALSE' ELSE 'TRUE' END AS VARCHAR2(5)) IS_LOCAL FROM( SELECT DB.DATABASE_NAME AS INDEX_OWNER, SUBSTR(TB1.TABLE_NAME, 7 + INSTR(SUBSTR(TB1.TABLE_NAME, 7), '_')) AS INDEX_NAME, TB1.TABLE_ID AS INDEX_TABLE_ID, TB1.DATA_TABLE_ID AS DATA_TABLE_ID, TB1.INDEX_TYPE AS INDEX_TYPE, TB1.PART_LEVEL AS PART_LEVEL /*USE DATA TABLE'S PART_LEVEL IF INDEX IS LOCAL INDEX*/ FROM SYS.ALL_VIRTUAL_TABLE_REAL_AGENT TB1, SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT DB WHERE DB.DATABASE_NAME!='__recyclebin' AND TB1.DATABASE_ID=DB.DATABASE_ID AND TB1.TABLE_TYPE=5 AND TB1.TENANT_ID = EFFECTIVE_TENANT_ID() AND DB.TENANT_ID = EFFECTIVE_TENANT_ID() ) A JOIN SYS.ALL_VIRTUAL_TABLE_REAL_AGENT TB2 ON A.DATA_TABLE_ID=TB2.TABLE_ID AND TB2.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE A.PART_LEVEL=1 OR ((A.INDEX_TYPE=1 OR A.INDEX_TYPE=2) AND TB2.PART_LEVEL=1) ) B JOIN SYS.ALL_VIRTUAL_PART_REAL_AGENT PART ON ((B.TABLE_ID=PART.TABLE_ID AND B.IS_LOCAL='FALSE') OR (B.DATA_TABLE_ID=PART.TABLE_ID AND B.IS_LOCAL='TRUE')) AND PART.TENANT_ID = EFFECTIVE_TENANT_ID() NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS DBA_IND_EXPRESSIONS SELECT CAST(INDEX_OWNER AS VARCHAR2(128)) AS INDEX_OWNER, CAST(INDEX_NAME AS VARCHAR2(128)) AS INDEX_NAME, CAST(TABLE_OWNER AS VARCHAR2(128)) AS TABLE_OWNER, CAST(H.TABLE_NAME AS VARCHAR2(128)) AS TABLE_NAME, CAST(COLUMN_EXPRESSION /* TODO: LONG */ AS VARCHAR2(1000)) AS COLUMN_EXPRESSION, COLUMN_POSITION FROM ( SELECT INDEX_OWNER, INDEX_NAME, TABLE_OWNER, F.CUR_DEFAULT_VALUE_V2 AS COLUMN_EXPRESSION, E.INDEX_POSITION AS COLUMN_POSITION, E.TABLE_ID AS TABLE_ID FROM (SELECT INDEX_OWNER, INDEX_NAME, TABLE_OWNER, C.TABLE_ID AS TABLE_ID, C.INDEX_ID AS INDEX_ID, D.COLUMN_ID AS COLUMN_ID, D.COLUMN_NAME AS COLUMN_NAME, D.INDEX_POSITION AS INDEX_POSITION FROM (SELECT DATABASE_NAME AS INDEX_OWNER, SUBSTR(TABLE_NAME, 7 + INSTR(SUBSTR(TABLE_NAME, 7), '_')) AS INDEX_NAME, DATABASE_NAME AS TABLE_OWNER, A.DATA_TABLE_ID AS TABLE_ID, A.TABLE_ID AS INDEX_ID FROM SYS.ALL_VIRTUAL_TABLE_REAL_AGENT A JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT B ON A.DATABASE_ID = B.DATABASE_ID AND B.DATABASE_NAME != '__recyclebin' AND A.TENANT_ID = EFFECTIVE_TENANT_ID() AND B.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE TABLE_TYPE=5 ) C JOIN SYS.ALL_VIRTUAL_COLUMN_REAL_AGENT D ON C.INDEX_ID=D.TABLE_ID AND D.TENANT_ID = EFFECTIVE_TENANT_ID()) E JOIN SYS.ALL_VIRTUAL_COLUMN_REAL_AGENT F ON F.TABLE_ID=E.TABLE_ID AND F.TENANT_ID = EFFECTIVE_TENANT_ID() AND F.COLUMN_ID=E.COLUMN_ID AND F.COLUMN_FLAGS=1) G JOIN SYS.ALL_VIRTUAL_TABLE_REAL_AGENT H ON G.TABLE_ID=H.TABLE_ID AND H.TENANT_ID = EFFECTIVE_TENANT_ID() NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS DBA_IND_EXPRESSIONS SELECT CAST(INDEX_OWNER AS VARCHAR2(128)) AS INDEX_OWNER, CAST(INDEX_NAME AS VARCHAR2(128)) AS INDEX_NAME, CAST(TABLE_OWNER AS VARCHAR2(128)) AS TABLE_OWNER, CAST(H.TABLE_NAME AS VARCHAR2(128)) AS TABLE_NAME, CAST(COLUMN_EXPRESSION /* TODO: LONG */ AS VARCHAR2(1000)) AS COLUMN_EXPRESSION, COLUMN_POSITION FROM ( SELECT INDEX_OWNER, INDEX_NAME, TABLE_OWNER, F.CUR_DEFAULT_VALUE_V2 AS COLUMN_EXPRESSION, E.INDEX_POSITION AS COLUMN_POSITION, E.TABLE_ID AS TABLE_ID FROM (SELECT INDEX_OWNER, INDEX_NAME, TABLE_OWNER, C.TABLE_ID AS TABLE_ID, C.INDEX_ID AS INDEX_ID, D.COLUMN_ID AS COLUMN_ID, D.COLUMN_NAME AS COLUMN_NAME, D.INDEX_POSITION AS INDEX_POSITION FROM (SELECT DATABASE_NAME AS INDEX_OWNER, SUBSTR(TABLE_NAME, 7 + INSTR(SUBSTR(TABLE_NAME, 7), '_')) AS INDEX_NAME, DATABASE_NAME AS TABLE_OWNER, A.DATA_TABLE_ID AS TABLE_ID, A.TABLE_ID AS INDEX_ID FROM SYS.ALL_VIRTUAL_TABLE_REAL_AGENT A JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT B ON A.DATABASE_ID = B.DATABASE_ID AND B.DATABASE_NAME != '__recyclebin' AND A.TENANT_ID = EFFECTIVE_TENANT_ID() AND B.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE TABLE_TYPE=5 ) C JOIN SYS.ALL_VIRTUAL_COLUMN_REAL_AGENT D ON C.INDEX_ID=D.TABLE_ID AND D.TENANT_ID = EFFECTIVE_TENANT_ID() AND D.INDEX_POSITION != 0) E JOIN SYS.ALL_VIRTUAL_COLUMN_REAL_AGENT F ON F.TABLE_ID=E.TABLE_ID AND F.TENANT_ID = EFFECTIVE_TENANT_ID() AND F.COLUMN_ID=E.COLUMN_ID AND BITAND(F.COLUMN_FLAGS,3) > 0) G JOIN SYS.ALL_VIRTUAL_TABLE_REAL_AGENT H ON G.TABLE_ID=H.TABLE_ID AND H.TENANT_ID = EFFECTIVE_TENANT_ID() NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS DBA_IND_COLUMNS SELECT CAST(INDEX_OWNER AS VARCHAR2(128)) AS INDEX_OWNER, CAST(INDEX_NAME AS VARCHAR2(128)) AS INDEX_NAME, CAST(TABLE_OWNER AS VARCHAR2(128)) AS TABLE_OWNER, CAST(TABLE_NAME AS VARCHAR2(128)) AS TABLE_NAME, CAST(COLUMN_NAME AS VARCHAR2(4000)) AS COLUMN_NAME, CAST(ROWKEY_POSITION AS NUMBER) AS COLUMN_POSITION, CASE WHEN DATA_TYPE >= 1 AND DATA_TYPE <= 16 THEN CAST(22 AS NUMBER) WHEN DATA_TYPE = 17 THEN CAST(7 AS NUMBER) WHEN DATA_TYPE IN (22, 23) AND F.DATA_PRECISION = 2 THEN CAST(DATA_LENGTH AS NUMBER) WHEN DATA_TYPE IN (22, 23) AND F.DATA_PRECISION = 1 AND F.COLLATION_TYPE IN (45, 46, 224, 54, 55, 101) THEN CAST(DATA_LENGTH * 4 AS NUMBER) WHEN DATA_TYPE IN (22, 23) AND F.DATA_PRECISION = 1 AND F.COLLATION_TYPE IN (28, 87) THEN CAST(DATA_LENGTH * 2 AS NUMBER) WHEN DATA_TYPE = 36 THEN CAST(12 AS NUMBER) WHEN DATA_TYPE IN (37, 38) THEN CAST(11 AS NUMBER) WHEN DATA_TYPE = 39 THEN CAST(DATA_LENGTH AS NUMBER) WHEN DATA_TYPE = 40 THEN CAST(5 AS NUMBER) WHEN DATA_TYPE = 41 THEN CAST(11 AS NUMBER) ELSE CAST(0 AS NUMBER) END AS COLUMN_LENGTH, CASE WHEN DATA_TYPE IN (22, 23) THEN CAST(DATA_LENGTH AS NUMBER) ELSE CAST(0 AS NUMBER) END AS CHAR_LENGTH, CAST('ASC' AS VARCHAR2(4)) AS DESCEND FROM (SELECT INDEX_OWNER, INDEX_NAME, TABLE_OWNER, TABLE_NAME, INDEX_ID, IDX_TYPE FROM (SELECT DATABASE_NAME AS INDEX_OWNER, CASE WHEN (TABLE_TYPE = 5) THEN SUBSTR(TABLE_NAME, 7 + INSTR(SUBSTR(TABLE_NAME, 7), '_')) ELSE (CONS_TAB.CONSTRAINT_NAME) END AS INDEX_NAME, DATABASE_NAME AS TABLE_OWNER, CASE WHEN (TABLE_TYPE = 3) THEN A.TABLE_ID ELSE A.DATA_TABLE_ID END AS TABLE_ID, A.TABLE_ID AS INDEX_ID, TABLE_TYPE AS IDX_TYPE FROM SYS.ALL_VIRTUAL_TABLE_REAL_AGENT A JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT B ON A.DATABASE_ID = B.DATABASE_ID AND TABLE_TYPE IN (5, 3) AND B.DATABASE_NAME != '__recyclebin' AND A.TENANT_ID = B.TENANT_ID AND A.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_CONSTRAINT_REAL_AGENT CONS_TAB ON (CONS_TAB.TABLE_ID = A.TABLE_ID AND A.TENANT_ID = CONS_TAB.TENANT_ID AND CONS_TAB.TENANT_ID = EFFECTIVE_TENANT_ID()) WHERE NOT( TABLE_TYPE = 3 AND CONSTRAINT_NAME IS NULL ) ) C JOIN SYS.ALL_VIRTUAL_TABLE_REAL_AGENT D ON C.TABLE_ID = D.TABLE_ID AND D.TENANT_ID = EFFECTIVE_TENANT_ID() ) E JOIN SYS.ALL_VIRTUAL_COLUMN_REAL_AGENT F ON E.INDEX_ID = F.TABLE_ID AND F.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE F.ROWKEY_POSITION != 0 AND (CASE WHEN IDX_TYPE = 5 THEN INDEX_POSITION ELSE 1 END) != 0 NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS DBA_INDEXES SELECT CAST(INDEX_OWNER AS VARCHAR2(128)) AS OWNER, CAST(INDEX_NAME AS VARCHAR2(128)) AS INDEX_NAME, CAST(INDEX_TYPE_NAME AS VARCHAR2(27)) AS INDEX_TYPE, CAST(TABLE_OWNER AS VARCHAR2(128)) AS TABLE_OWNER, CAST(TABLE_NAME AS VARCHAR2(128)) AS TABLE_NAME, CAST('TABLE' AS CHAR(5)) AS TABLE_TYPE, CAST(UNIQUENESS AS VARCHAR2(9)) AS UNIQUENESS, CAST(COMPRESSION AS VARCHAR2(8)) AS COMPRESSION, CAST(NULL AS NUMBER) AS PREFIX_LENGTH, CAST(TABLESPACE_NAME AS VARCHAR2(30)) AS TABLESPACE_NAME, CAST(NULL AS NUMBER) AS INI_TRANS, CAST(NULL AS NUMBER) AS MAX_TRANS, CAST(NULL AS NUMBER) AS INITIAL_EXTENT, CAST(NULL AS NUMBER) AS NEXT_EXTENT, CAST(NULL AS NUMBER) AS MIN_EXTENTS, CAST(NULL AS NUMBER) AS MAX_EXTENTS, CAST(NULL AS NUMBER) AS PCT_INCREASE, CAST(NULL AS NUMBER) AS PCT_THRESHOLD, CAST(NULL AS NUMBER) AS INCLUDE_COLUMN, CAST(NULL AS NUMBER) AS FREELISTS, CAST(NULL AS NUMBER) AS FREELIST_GROUPS, CAST(NULL AS NUMBER) AS PCT_FREE, CAST(NULL AS VARCHAR2(3)) AS LOGGING, CAST(NULL AS NUMBER) AS BLEVEL, CAST(NULL AS NUMBER) AS LEAF_BLOCKS, CAST(NULL AS NUMBER) AS DISTINCT_KEYS, CAST(NULL AS NUMBER) AS AVG_LEAF_BLOCKS_PER_KEY, CAST(NULL AS NUMBER) AS AVG_DATA_BLOCKS_PER_KEY, CAST(NULL AS NUMBER) AS CLUSTERING_FACTOR, CAST(STATUS AS VARCHAR2(10)) AS STATUS, CAST(NULL AS NUMBER) AS NUM_ROWS, CAST(NULL AS NUMBER) AS SAMPLE_SIZE, CAST(NULL AS DATE) AS LAST_ANALYZED, CAST(NULL AS VARCHAR2(40)) AS DEGREE, CAST(NULL AS VARCHAR2(40)) AS INSTANCES, CAST(CASE WHEN A_TABLE_TYPE = 3 THEN 'NO' WHEN A_INDEX_TYPE = 1 OR A_INDEX_TYPE = 2 THEN (CASE WHEN D.PART_LEVEL = 0 THEN 'NO' ELSE 'YES' END) ELSE (CASE WHEN A_PART_LEVEL = 0 THEN 'NO' ELSE 'YES' END) END AS VARCHAR2(3)) AS PARTITIONED, CAST(NULL AS VARCHAR2(1)) AS TEMPORARY, CAST(NULL AS VARCHAR2(1)) AS "GENERATED", CAST(NULL AS VARCHAR2(1)) AS SECONDARY, CAST(NULL AS VARCHAR2(7)) AS BUFFER_POOL, CAST(NULL AS VARCHAR2(7)) AS FLASH_CACHE, CAST(NULL AS VARCHAR2(7)) AS CELL_FLASH_CACHE, CAST(NULL AS VARCHAR2(3)) AS USER_STATS, CAST(NULL AS VARCHAR2(15)) AS DURATION, CAST(NULL AS NUMBER) AS PCT_DIRECT_ACCESS, CAST(NULL AS VARCHAR2(30)) AS ITYP_OWNER, CAST(NULL AS VARCHAR2(30)) AS ITYP_NAME, CAST(NULL AS VARCHAR2(1000)) AS PARAMETERS, CAST(NULL AS VARCHAR2(3)) AS GLOBAL_STATS, CAST(NULL AS VARCHAR2(12)) AS DOMIDX_STATUS, CAST(NULL AS VARCHAR2(6)) AS DOMIDX_OPSTATUS, CAST(FUNCIDX_STATUS AS VARCHAR2(8)) AS FUNCIDX_STATUS, CAST('NO' AS VARCHAR2(3)) AS JOIN_INDEX, CAST(NULL AS VARCHAR2(3)) AS IOT_REDUNDANT_PKEY_ELIM, CAST(DROPPED AS VARCHAR2(9)) AS DROPPED, CAST(VISIBILITY AS VARCHAR2(10)) AS VISIBILITY, CAST(NULL AS VARCHAR2(14)) AS DOMIDX_MANAGEMENT, CAST(NULL AS VARCHAR2(3)) AS SEGMENT_CREATED FROM (SELECT DATABASE_NAME AS INDEX_OWNER, CASE WHEN (TABLE_TYPE = 5 AND B.DATABASE_NAME != '__recyclebin') THEN SUBSTR(TABLE_NAME, 7 + INSTR(SUBSTR(TABLE_NAME, 7), '_')) WHEN (TABLE_TYPE = 5 AND B.DATABASE_NAME = '__recyclebin') THEN TABLE_NAME ELSE (CONS_TAB.CONSTRAINT_NAME) END AS INDEX_NAME, CASE WHEN A.TABLE_TYPE = 5 AND EXISTS ( SELECT 1 FROM SYS.ALL_VIRTUAL_COLUMN_REAL_AGENT T_COL_INDEX, SYS.ALL_VIRTUAL_COLUMN_REAL_AGENT T_COL_BASE WHERE T_COL_BASE.TABLE_ID = A.DATA_TABLE_ID AND T_COL_BASE.COLUMN_NAME = T_COL_INDEX.COLUMN_NAME AND T_COL_INDEX.TABLE_ID = A.TABLE_ID AND T_COL_BASE.TENANT_ID = A.TENANT_ID AND T_COL_INDEX.TENANT_ID = A.TENANT_ID AND BITAND(T_COL_BASE.COLUMN_FLAGS,3) > 0 ) THEN 'FUNCTION-BASED NORMAL' ELSE 'NORMAL' END AS INDEX_TYPE_NAME, DATABASE_NAME AS TABLE_OWNER, CASE WHEN (TABLE_TYPE = 3) THEN A.TABLE_ID ELSE A.DATA_TABLE_ID END AS TABLE_ID, A.TABLE_ID AS INDEX_ID, CASE WHEN TABLE_TYPE = 3 THEN 'UNIQUE' WHEN A.INDEX_TYPE IN (2, 4, 8) THEN 'UNIQUE' ELSE 'NONUNIQUE' END AS UNIQUENESS, CASE WHEN A.COMPRESS_FUNC_NAME = NULL THEN 'DISABLED' ELSE 'ENABLED' END AS COMPRESSION, CASE WHEN TABLE_TYPE = 3 THEN 'VALID' WHEN A.INDEX_STATUS = 2 THEN 'VALID' WHEN A.INDEX_STATUS = 3 THEN 'CHECKING' WHEN A.INDEX_STATUS = 4 THEN 'INELEGIBLE' WHEN A.INDEX_STATUS = 5 THEN 'ERROR' ELSE 'UNUSABLE' END AS STATUS, A.INDEX_TYPE AS A_INDEX_TYPE, A.PART_LEVEL AS A_PART_LEVEL, A.TABLE_TYPE AS A_TABLE_TYPE, CASE WHEN 0 = (SELECT COUNT(1) FROM SYS.ALL_VIRTUAL_COLUMN_REAL_AGENT WHERE TABLE_ID = A.TABLE_ID AND IS_HIDDEN = 0 AND TENANT_ID = EFFECTIVE_TENANT_ID()) THEN 'ENABLED' ELSE 'NULL' END AS FUNCIDX_STATUS, CASE WHEN B.DATABASE_NAME = '__recyclebin' THEN 'YES' ELSE 'NO' END AS DROPPED, CASE WHEN BITAND(A.INDEX_ATTRIBUTES_SET, 1) = 0 THEN 'VISIBLE' ELSE 'INVISIBLE' END AS VISIBILITY, A.TABLESPACE_ID FROM SYS.ALL_VIRTUAL_TABLE_REAL_AGENT A JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT B ON A.DATABASE_ID = B.DATABASE_ID AND TABLE_TYPE IN (5, 3) AND A.TENANT_ID = EFFECTIVE_TENANT_ID() AND B.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_CONSTRAINT_REAL_AGENT CONS_TAB ON (CONS_TAB.TABLE_ID = A.TABLE_ID) AND CONS_TAB.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE NOT(TABLE_TYPE = 3 AND CONSTRAINT_NAME IS NULL) AND (CONS_TAB.CONSTRAINT_TYPE IS NULL OR CONS_TAB.CONSTRAINT_TYPE = 1) ) C JOIN SYS.ALL_VIRTUAL_TABLE_REAL_AGENT D ON C.TABLE_ID = D.TABLE_ID AND D.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_TENANT_TABLESPACE_REAL_AGENT TP ON C.TABLESPACE_ID = TP.TABLESPACE_ID AND TP.TENANT_ID = EFFECTIVE_TENANT_ID() NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS DBA_ERRORS SELECT CAST(o.owner AS VARCHAR2(128)) AS OWNER, CAST(o.object_name AS VARCHAR2(128)) AS NAME, CAST(o.object_type AS VARCHAR2(19)) AS TYPE, CAST(e.obj_seq AS NUMBER) AS SEQUENCE, CAST(e.line AS NUMBER) AS LINE, CAST(e.position AS NUMBER) AS POSITION, CAST(e.text as VARCHAR2(4000)) AS TEXT, CAST(DECODE(e.property, 0, 'ERROR', 1, 'WARNING', 'UNDEFINED') AS VARCHAR2(9)) AS ATTRIBUTE, CAST(e.error_number AS NUMBER) AS MESSAGE_NUMBER FROM all_objects o, (select obj_id, obj_seq, line, position, text, property, error_number, CAST( UPPER(decode(obj_type, 3, 'PACKAGE', 4, 'TYPE', 5, 'PACKAGE BODY', 6, 'TYPE BODY', 7, 'TRIGGER', 8, 'VIEW', 9, 'FUNCTION', 12, 'PROCEDURE', 'MAXTYPE')) AS VARCHAR2(23)) object_type from sys.ALL_VIRTUAL_TENANT_ERROR_REAL_AGENT WHERE TENANT_ID = EFFECTIVE_TENANT_ID()) e WHERE o.object_id = e.obj_id AND o.object_type like e.object_type AND o.object_type IN (UPPER('package'), UPPER('type'), UPPER('procedure'), UPPER('function'), UPPER('package body'), UPPER('view'), UPPER('trigger'), UPPER('type body'), UPPER('library'), UPPER('queue'), UPPER('java source'), UPPER('java class'), UPPER('dimension'), UPPER('assembly'), UPPER('hierarchy'), UPPER('arrtibute dimension'), UPPER('analytic view')) NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
...
...
@@ -191,7 +191,7 @@ def SYS ALL_TAB_PRIVS SELECT B.USER_NAME AS GRANTOR, C.USER_NAME AS
def SYS ALL_TAB_PARTITIONS SELECT CAST(DB_TB.DATABASE_NAME AS VARCHAR2(128)) TABLE_OWNER, CAST(DB_TB.TABLE_NAME AS VARCHAR2(128)) TABLE_NAME, CAST(CASE WHEN PART.SUB_PART_NUM <=0 THEN 'NO' ELSE 'YES' END AS VARCHAR(3)) COMPOSITE, CAST(PART.PART_NAME AS VARCHAR(128)) PARTITION_NAME, CAST(PART.SUB_PART_NUM AS NUMBER) SUBPARTITION_COUNT, CAST(CASE WHEN length(PART.HIGH_BOUND_VAL) > 0 THEN PART.HIGH_BOUND_VAL ELSE PART.LIST_VAL END AS VARCHAR2(1024)) HIGH_VALUE, CAST(CASE WHEN length(PART.HIGH_BOUND_VAL) > 0 THEN length(PART.HIGH_BOUND_VAL) ELSE length(PART.LIST_VAL) END AS NUMBER) HIGH_VALUE_LENGTH, CAST(PART.PART_ID + 1 AS NUMBER) PARTITION_POSITION, CAST(TP.TABLESPACE_NAME AS VARCHAR2(30)) TABLESPACE_NAME, CAST(NULL AS NUMBER) PCT_FREE, CAST(NULL AS NUMBER) PCT_USED, CAST(NULL AS NUMBER) INI_TRANS, CAST(NULL AS NUMBER) MAX_TRANS, CAST(NULL AS NUMBER) INITIAL_EXTENT, CAST(NULL AS NUMBER) NEXT_EXTENT, CAST(NULL AS NUMBER) MIN_EXTENT, CAST(NULL AS NUMBER) MAX_EXTENT, CAST(NULL AS NUMBER) MAX_SIZE, CAST(NULL AS NUMBER) PCT_INCREASE, CAST(NULL AS NUMBER) FREELISTS, CAST(NULL AS NUMBER) FREELIST_GROUPS, CAST(NULL AS VARCHAR2(7)) LOGGING, CAST(CASE WHEN PART.COMPRESS_FUNC_NAME IS NULL THEN 'DISABLED' ELSE 'ENABLED' END AS VARCHAR2(8)) COMPRESSION, CAST(PART.COMPRESS_FUNC_NAME AS VARCHAR2(12)) COMPRESS_FOR, CAST(NULL AS NUMBER) NUM_ROWS, CAST(NULL AS NUMBER) BLOCKS, CAST(NULL AS NUMBER) EMPTY_BLOCKS, CAST(NULL AS NUMBER) AVG_SPACE, CAST(NULL AS NUMBER) CHAIN_CNT, CAST(NULL AS NUMBER) AVG_ROW_LEN, CAST(NULL AS NUMBER) SAMPLE_SIZE, CAST(NULL AS DATE) LAST_ANALYZED, CAST(NULL AS VARCHAR2(7)) BUFFER_POOL, CAST(NULL AS VARCHAR2(7)) FLASH_CACHE, CAST(NULL AS VARCHAR2(7)) CELL_FLASH_CACHE, CAST(NULL AS VARCHAR2(3)) GLOBAL_STATS, CAST(NULL AS VARCHAR2(3)) USER_STATS, CAST(NULL AS VARCHAR2(3)) IS_NESTED, CAST(NULL AS VARCHAR2(30)) PARENT_TABLE_PARTITION, CAST(NULL AS VARCHAR2(3)) "INTERVAL", CAST(NULL AS VARCHAR2(4)) SEGMENT_CREATED FROM (SELECT DB.DATABASE_NAME, DB.DATABASE_ID, TB.TABLE_ID, TB.TABLE_NAME FROM SYS.ALL_VIRTUAL_TABLE_REAL_AGENT TB, SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT DB WHERE TB.DATABASE_ID = DB.DATABASE_ID AND TB.TENANT_ID = EFFECTIVE_TENANT_ID() AND DB.TENANT_ID = EFFECTIVE_TENANT_ID() AND (TB.DATABASE_ID = USERENV('SCHEMAID') OR USER_CAN_ACCESS_OBJ(1, TB.TABLE_ID, TB.DATABASE_ID) = 1)) DB_TB JOIN SYS.ALL_VIRTUAL_PART_REAL_AGENT PART ON DB_TB.TABLE_ID = PART.TABLE_ID AND PART.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_TENANT_TABLESPACE_REAL_AGENT TP ON TP.TABLESPACE_ID = PART.TABLESPACE_ID AND TP.TENANT_ID = EFFECTIVE_TENANT_ID() NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS ALL_TAB_COMMENTS SELECT A.DATABASE_NAME AS OWNER, CAST(B.TABLE_NAME AS VARCHAR2(128)) AS TABLE_NAME, CAST(CASE WHEN TABLE_TYPE = 0 OR TABLE_TYPE = 2 OR TABLE_TYPE = 3 OR TABLE_TYPE = 5 OR TABLE_TYPE = 8 OR TABLE_TYPE = 9 THEN 'TABLE' WHEN TABLE_TYPE = 1 OR TABLE_TYPE = 4 OR TABLE_TYPE = 7 THEN 'VIEW' ELSE NULL END AS VARCHAR2(11)) AS TABLE_TYPE, CAST(B."COMMENT" AS VARCHAR(4000)) AS COMMENTS FROM SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT A JOIN SYS.ALL_VIRTUAL_TABLE_REAL_AGENT B ON A.DATABASE_ID = B.DATABASE_ID AND A.TENANT_ID = EFFECTIVE_TENANT_ID() AND B.TENANT_ID = EFFECTIVE_TENANT_ID() AND (A.DATABASE_ID = USERENV('SCHEMAID') OR USER_CAN_ACCESS_OBJ(1, TABLE_ID, A.DATABASE_ID) = 1) NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS ALL_TAB_COLS_V$ SELECT cast(db.database_name as VARCHAR2(128)) as OWNER, cast(t.table_name as VARCHAR2(128)) as TABLE_NAME, cast(c.column_name as VARCHAR2(128)) as COLUMN_NAME, cast(decode(c.data_type, 0, 'NULL', 1, 'NUMBER', 2, 'NUMBER', 3, 'NUMBER', 4, 'NUMBER', 5, 'NUMBER', 6, 'NUMBER', 7, 'NUMBER', 8, 'NUMBER', 9, 'NUMBER', 10, 'NUMBER', 11, 'BINARY_FLOAT', 12, 'BINARY_DOUBLE', 13, 'NUMBER', 14, 'NUMBER', 15, 'NUMBER', 16, 'NUMBER', 17, 'DATE', 18, 'TIMESTAMP', 19, 'DATE', 20, 'TIME', 21, 'YEAR', 22, 'VARCHAR2', 23, 'CHAR', 24, 'HEX_STRING', 25, 'EXT', 26, 'UNKNOWN', 27, 'TINYTEXT', 28, 'TEXT', 29, 'MEDIUMTEXT', 30, decode(c.collation_type, 63, 'BLOB', 'CLOB'), 31, 'BIT', 32, 'ENUM', 33, 'SET', 34, 'ENUM_INNER', 35, 'SET_INNER', 36, concat('TIMESTAMP(', concat(c.data_scale, ') WITH TIME ZONE')), 37, concat('TIMESTAMP(', concat(c.data_scale, ') WITH LOCAL TIME ZONE')), 38, concat('TIMESTAMP(', concat(c.data_scale, ')')), 39, 'RAW', 40, concat('INTERVAL YEAR(', concat(c.data_scale, ') TO MONTH')), 41, concat('INTERVAL DAY(', concat(trunc(c.data_scale/10), concat(') TO SECOND(', concat(mod(c.data_scale, 10), ')')))), 42, 'FLOAT', 43, 'NVARCHAR2', 44, 'NCHAR', 45, 'UROWID', 46, '', 'UNDEFINED') as VARCHAR2(128)) as DATA_TYPE, cast(NULL as VARCHAR2(3)) as DATA_TYPE_MOD, cast(NULL as VARCHAR2(128)) as DATA_TYPE_OWNER, cast(c.data_length as NUMBER) as DATA_LENGTH, cast(CASE WHEN c.data_type in (11,12,17,18,19,22,23,27,28,29,30,36,37,38,43,44) THEN NULL ELSE CASE WHEN c.data_precision < 0 THEN NULL ELSE c.data_precision END END as NUMBER) as DATA_PRECISION, cast(CASE WHEN c.data_type in (11,12,17,19,22,23,27,28,29,30,42,43,44) THEN NULL ELSE CASE WHEN c.data_scale < -84 THEN NULL ELSE c.data_scale END END as NUMBER) as DATA_SCALE, cast(decode(c.nullable, 1, 'Y', 'N') as VARCHAR2(1)) as NULLABLE, cast(decode(BITAND(c.column_flags, 64), 0, c.column_id, NULL) as NUMBER) as COLUMN_ID, cast(LENGTHB(c.cur_default_value_v2) as NUMBER) as DEFAULT_LENGTH, cast(c.cur_default_value_v2 as /* TODO: LONG() */ VARCHAR(128)) as DATA_DEFAULT, cast(NULL as NUMBER) as NUM_DISTINCT, cast(NULL as /* TODO: RAW */ varchar(128)) as LOW_VALUE, cast(NULL as /* TODO: RAW */ varchar(128)) as HIGH_VALUE, cast(NULL as NUMBER) as DENSITY, cast(NULL as NUMBER) as NUM_NULLS, cast(NULL as NUMBER) as NUM_BUCKETS, cast(NULL as DATE) as LAST_ANALYZED, cast(NULL as NUMBER) as SAMPLE_SIZE, cast(NULL as VARCHAR2(44)) as CHARACTER_SET_NAME, cast(NULL as NUMBER) as CHAR_COL_DECL_LENGTH, cast(NULL as VARCHAR2(3)) as GLOBAL_STATS, cast(NULL as VARCHAR2(3)) as USER_STATS, cast(NULL as VARCHAR2(80)) as NOTES, cast(NULL as NUMBER) as AVG_COL_LEN, cast(decode(c.data_type, 22, c.data_length, 23, c.data_length, 0) as NUMBER) as CHAR_LENGTH, cast(decode(c.data_type, 22, decode(c.data_precision, 1, 'C', 'B'), 23, decode(c.data_precision, 1, 'C', 'B'), NULL) as VARCHAR2(1)) as CHAR_USED, cast(NULL as VARCHAR2(3)) as V80_FMT_IMAGE, cast(NULL as VARCHAR2(3)) as DATA_UPGRADED, cast(decode(BITAND(c.column_flags, 64), 0, 'NO', 'YES') as VARCHAR2(3)) as HIDDEN_COLUMN, cast(decode(BITAND(c.column_flags, 1), 1, 'YES', 'NO') as VARCHAR2(3)) as VIRTUAL_COLUMN, cast(NULL as NUMBER) as SEGMENT_COLUMN_ID, cast(NULL as NUMBER) as INTERNAL_COLUMN_ID, cast(NULL as VARCHAR2(15)) as HISTOGRAM, cast(c.column_name as VARCHAR2(4000)) as QUALIFIED_COL_NAME, cast('YES' as VARCHAR2(3)) as USER_GENERATED, cast(NULL as VARCHAR2(3)) as DEFAULT_ON_NULL, cast(NULL as VARCHAR2(3)) as IDENTITY_COLUMN, cast(NULL as VARCHAR2(128)) as EVALUATION_EDITION, cast(NULL as VARCHAR2(128)) as UNUSABLE_BEFORE, cast(NULL as VARCHAR2(128)) as UNUSABLE_BEGINNING, cast(NULL as VARCHAR2(100)) as COLLATION, cast(NULL as NUMBER) as COLLATED_COLUMN_ID FROM sys.ALL_VIRTUAL_TABLE_REAL_AGENT t JOIN sys.ALL_VIRTUAL_DATABASE_REAL_AGENT db ON db.tenant_id = t.tenant_id AND db.database_id = t.database_id AND (t.database_id = userenv('SCHEMAID') OR user_can_access_obj(1, t.table_id, t.database_id) = 1) AND T.TENANT_ID = EFFECTIVE_TENANT_ID() AND DB.TENANT_ID = EFFECTIVE_TENANT_ID() JOIN sys.ALL_VIRTUAL_COLUMN_REAL_AGENT c ON c.tenant_id = t.tenant_id AND c.table_id = t.table_id AND C.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE c.is_hidden = 0 AND t.table_type in (0,2,3,8,9) NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS ALL_TAB_COLS_V$ SELECT cast(db.database_name as VARCHAR2(128)) as OWNER, cast(t.table_name as VARCHAR2(128)) as TABLE_NAME, cast(c.column_name as VARCHAR2(128)) as COLUMN_NAME, cast(decode(c.data_type, 0, 'NULL', 1, 'NUMBER', 2, 'NUMBER', 3, 'NUMBER', 4, 'NUMBER', 5, 'NUMBER', 6, 'NUMBER', 7, 'NUMBER', 8, 'NUMBER', 9, 'NUMBER', 10, 'NUMBER', 11, 'BINARY_FLOAT', 12, 'BINARY_DOUBLE', 13, 'NUMBER', 14, 'NUMBER', 15, 'NUMBER', 16, 'NUMBER', 17, 'DATE', 18, 'TIMESTAMP', 19, 'DATE', 20, 'TIME', 21, 'YEAR', 22, 'VARCHAR2', 23, 'CHAR', 24, 'HEX_STRING', 25, 'EXT', 26, 'UNKNOWN', 27, 'TINYTEXT', 28, 'TEXT', 29, 'MEDIUMTEXT', 30, decode(c.collation_type, 63, 'BLOB', 'CLOB'), 31, 'BIT', 32, 'ENUM', 33, 'SET', 34, 'ENUM_INNER', 35, 'SET_INNER', 36, concat('TIMESTAMP(', concat(c.data_scale, ') WITH TIME ZONE')), 37, concat('TIMESTAMP(', concat(c.data_scale, ') WITH LOCAL TIME ZONE')), 38, concat('TIMESTAMP(', concat(c.data_scale, ')')), 39, 'RAW', 40, concat('INTERVAL YEAR(', concat(c.data_scale, ') TO MONTH')), 41, concat('INTERVAL DAY(', concat(trunc(c.data_scale/10), concat(') TO SECOND(', concat(mod(c.data_scale, 10), ')')))), 42, 'FLOAT', 43, 'NVARCHAR2', 44, 'NCHAR', 45, 'UROWID', 46, '', 'UNDEFINED') as VARCHAR2(128)) as DATA_TYPE, cast(NULL as VARCHAR2(3)) as DATA_TYPE_MOD, cast(NULL as VARCHAR2(128)) as DATA_TYPE_OWNER, cast(c.data_length * CASE WHEN c.data_type in (22,23,30,43,44,46) and c.data_precision = 1 THEN decode(c.collation_type, 63, 1, 249, 4, 248, 4, 87, 2, 28, 2, 55, 4, 54, 4, 101, 2, 46, 4, 45, 4, 224, 4, 1) ELSE 1 END as NUMBER) as DATA_LENGTH, cast(CASE WHEN c.data_type in (11,12,17,18,19,22,23,27,28,29,30,36,37,38,43,44) THEN NULL ELSE CASE WHEN c.data_precision < 0 THEN NULL ELSE c.data_precision END END as NUMBER) as DATA_PRECISION, cast(CASE WHEN c.data_type in (11,12,17,19,22,23,27,28,29,30,42,43,44) THEN NULL ELSE CASE WHEN c.data_scale < -84 THEN NULL ELSE c.data_scale END END as NUMBER) as DATA_SCALE, cast(decode(c.nullable, 1, 'Y', 'N') as VARCHAR2(1)) as NULLABLE, cast(decode(BITAND(c.column_flags, 64), 0, c.column_id, NULL) as NUMBER) as COLUMN_ID, cast(LENGTHB(c.cur_default_value_v2) as NUMBER) as DEFAULT_LENGTH, cast(c.cur_default_value_v2 as /* TODO: LONG() */ VARCHAR(128)) as DATA_DEFAULT, cast(NULL as NUMBER) as NUM_DISTINCT, cast(NULL as /* TODO: RAW */ varchar(128)) as LOW_VALUE, cast(NULL as /* TODO: RAW */ varchar(128)) as HIGH_VALUE, cast(NULL as NUMBER) as DENSITY, cast(NULL as NUMBER) as NUM_NULLS, cast(NULL as NUMBER) as NUM_BUCKETS, cast(NULL as DATE) as LAST_ANALYZED, cast(NULL as NUMBER) as SAMPLE_SIZE, cast(decode(c.data_type, 22, 'CHAR_CS', 23, 'CHAR_CS', 30, decode(c.collation_type, 63, 'NULL', 'CHAR_CS'), 43, 'NCHAR_CS', 44, 'NCHAR_CS', '') as VARCHAR2(44)) as CHARACTER_SET_NAME, cast(NULL as NUMBER) as CHAR_COL_DECL_LENGTH, cast(NULL as VARCHAR2(3)) as GLOBAL_STATS, cast(NULL as VARCHAR2(3)) as USER_STATS, cast(NULL as VARCHAR2(80)) as NOTES, cast(NULL as NUMBER) as AVG_COL_LEN, cast(CASE WHEN c.data_type in (22,23,43,44) THEN c.data_length ELSE 0 END as NUMBER) as CHAR_LENGTH, cast(decode(c.data_type, 22, decode(c.data_precision, 1, 'C', 'B'), 23, decode(c.data_precision, 1, 'C', 'B'), 43, decode(c.data_precision, 1, 'C', 'B'), 44, decode(c.data_precision, 1, 'C', 'B'), NULL) as VARCHAR2(1)) as CHAR_USED, cast(NULL as VARCHAR2(3)) as V80_FMT_IMAGE, cast(NULL as VARCHAR2(3)) as DATA_UPGRADED, cast(decode(BITAND(c.column_flags, 64), 0, 'NO', 'YES') as VARCHAR2(3)) as HIDDEN_COLUMN, cast(decode(BITAND(c.column_flags, 1), 1, 'YES', 'NO') as VARCHAR2(3)) as VIRTUAL_COLUMN, cast(NULL as NUMBER) as SEGMENT_COLUMN_ID, cast(NULL as NUMBER) as INTERNAL_COLUMN_ID, cast(NULL as VARCHAR2(15)) as HISTOGRAM, cast(c.column_name as VARCHAR2(4000)) as QUALIFIED_COL_NAME, cast('YES' as VARCHAR2(3)) as USER_GENERATED, cast(NULL as VARCHAR2(3)) as DEFAULT_ON_NULL, cast(NULL as VARCHAR2(3)) as IDENTITY_COLUMN, cast(NULL as VARCHAR2(128)) as EVALUATION_EDITION, cast(NULL as VARCHAR2(128)) as UNUSABLE_BEFORE, cast(NULL as VARCHAR2(128)) as UNUSABLE_BEGINNING, cast(NULL as VARCHAR2(100)) as COLLATION, cast(NULL as NUMBER) as COLLATED_COLUMN_ID FROM sys.ALL_VIRTUAL_TABLE_REAL_AGENT t JOIN sys.ALL_VIRTUAL_DATABASE_REAL_AGENT db ON db.tenant_id = t.tenant_id AND db.database_id = t.database_id AND (t.database_id = userenv('SCHEMAID') OR user_can_access_obj(1, t.table_id, t.database_id) = 1) AND T.TENANT_ID = EFFECTIVE_TENANT_ID() AND DB.TENANT_ID = EFFECTIVE_TENANT_ID() JOIN sys.ALL_VIRTUAL_COLUMN_REAL_AGENT c ON c.tenant_id = t.tenant_id AND c.table_id = t.table_id AND C.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE c.is_hidden = 0 AND t.table_type in (0,2,3,8,9) NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS ALL_TABLES SELECT CAST(db.database_name AS VARCHAR2(128)) AS OWNER, CAST(t.table_name AS VARCHAR2(128)) AS TABLE_NAME, CAST(tp.tablespace_name AS VARCHAR2(30)) AS TABLESPACE_NAME, CAST(NULL AS VARCHAR2(128)) AS CLUSTER_NAME, CAST(NULL AS VARCHAR2(128)) AS IOT_NAME, CAST('VALID' AS VARCHAR2(8)) AS STATUS, CAST(t."PCTFREE" AS NUMBER) AS PCT_FREE, CAST(NULL AS NUMBER) AS PCT_USED, CAST(NULL AS NUMBER) AS INI_TRANS, CAST(NULL AS NUMBER) AS MAX_TRANS, CAST(NULL AS NUMBER) AS INITIAL_EXTENT, CAST(NULL AS NUMBER) AS NEXT_EXTENT, CAST(NULL AS NUMBER) AS MIN_EXTENTS, CAST(NULL AS NUMBER) AS MAX_EXTENTS, CAST(NULL AS NUMBER) AS PCT_INCREASE, CAST(NULL AS NUMBER) AS FREELISTS, CAST(NULL AS NUMBER) AS FREELIST_GROUPS, CAST(NULL AS VARCHAR2(3)) AS LOGGING, CAST(NULL AS VARCHAR2(1)) AS BACKED_UP, CAST(info.row_count AS NUMBER) AS NUM_ROWS, CAST(NULL AS NUMBER) AS BLOCKS, CAST(NULL AS NUMBER) AS EMPTY_BLOCKS, CAST(NULL AS NUMBER) AS AVG_SPACE, CAST(NULL AS NUMBER) AS CHAIN_CNT, CAST(NULL AS NUMBER) AS AVG_ROW_LEN, CAST(NULL AS NUMBER) AS AVG_SPACE_FREELIST_BLOCKS, CAST(NULL AS NUMBER) AS NUM_FREELIST_BLOCKS, CAST(NULL AS VARCHAR2(40)) AS DEGREE, CAST(NULL AS VARCHAR2(40)) AS INSTANCES, CAST(NULL AS VARCHAR2(20)) AS CACHE, CAST(NULL AS VARCHAR2(8)) AS TABLE_LOCK, CAST(NULL AS NUMBER) AS SAMPLE_SIZE, CAST(NULL AS DATE) AS LAST_ANALYZED, CAST( CASE WHEN t.part_level = 0 THEN 'NO' ELSE 'YES' END AS VARCHAR2(3)) AS PARTITIONED, CAST(NULL AS VARCHAR2(12)) AS IOT_TYPE, CAST(decode (t.table_type, 8, 'YES', 9, 'YES', 'NO') AS VARCHAR2(1)) AS TEMPORARY, CAST(NULL AS VARCHAR2(1)) AS SECONDARY, CAST('NO' AS VARCHAR2(3)) AS NESTED, CAST(NULL AS VARCHAR2(7)) AS BUFFER_POOL, CAST(NULL AS VARCHAR2(7)) AS FLASH_CACHE, CAST(NULL AS VARCHAR2(7)) AS CELL_FLASH_CACHE, CAST(NULL AS VARCHAR2(8)) AS ROW_MOVEMENT, CAST(NULL AS VARCHAR2(3)) AS GLOBAL_STATS, CAST(NULL AS VARCHAR2(3)) AS USER_STATS, CAST( decode (t.table_type, 8, 'SYS$SESSION', 9, 'SYS$TRANSACTION', NULL) AS VARCHAR2(15)) AS DURATION, CAST(NULL AS VARCHAR2(8)) AS SKIP_CORRUPT, CAST(NULL AS VARCHAR2(3)) AS MONITORING, CAST(NULL AS VARCHAR2(30)) AS CLUSTER_OWNER, CAST(NULL AS VARCHAR2(8)) AS DEPENDENCIES, CAST(NULL AS VARCHAR2(8)) AS COMPRESSION, CAST(NULL AS VARCHAR2(12)) AS COMPRESS_FOR, CAST( CASE WHEN db.database_name = '__recyclebin' THEN 'YES' ELSE 'NO' END AS VARCHAR2(3)) AS DROPPED, CAST(NULL AS VARCHAR2(3)) AS READ_ONLY, CAST(NULL AS VARCHAR2(3)) AS SEGMENT_CREATED, CAST(NULL AS VARCHAR2(7)) AS RESULT_CACHE FROM ( SELECT tenant_id, table_id, SUM(row_count) AS row_count FROM sys.ALL_VIRTUAL_TENANT_PARTITION_META_TABLE_REAL_AGENT p WHERE p.role = 1 AND P.TENANT_ID = EFFECTIVE_TENANT_ID() GROUP BY tenant_id, table_id ) info RIGHT JOIN sys.ALL_VIRTUAL_TABLE_REAL_AGENT t ON t.tenant_id = info.tenant_id AND t.table_id = info.table_id AND T.TENANT_ID = EFFECTIVE_TENANT_ID() JOIN sys.ALL_VIRTUAL_DATABASE_REAL_AGENT db ON db.tenant_id = t.tenant_id AND db.database_id = t.database_id AND db.database_name != '__recyclebin' AND t.table_type in (3, 8, 9, 11) AND DB.TENANT_ID = EFFECTIVE_TENANT_ID() AND (t.database_id = USERENV('SCHEMAID') or user_can_access_obj(1, t.table_id, t.database_id) =1) LEFT JOIN sys.ALL_VIRTUAL_TENANT_TABLESPACE_REAL_AGENT tp ON tp.tablespace_id = t.tablespace_id AND t.tenant_id = tp.tenant_id AND TP.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE t.session_id = 0 NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS ALL_SYNONYMS SELECT CASE WHEN A.DATABASE_NAME = '__public' THEN 'PUBLIC' ELSE A.DATABASE_NAME END AS OWNER, A.SYNONYM_NAME AS SYNONYM_NAME, CAST(CASE WHEN INSTR(A.OBJECT_NAME, '@') = 0 THEN B.DATABASE_NAME ELSE SUBSTR(A.OBJECT_NAME, 1, INSTR(A.OBJECT_NAME, '.') -1) END AS VARCHAR2(128)) AS TABLE_OWNER, CAST(CASE WHEN INSTR(A.OBJECT_NAME, '@') = 0 THEN A.OBJECT_NAME ELSE SUBSTR(A.OBJECT_NAME, INSTR(A.OBJECT_NAME, '.') + 1, INSTR(A.OBJECT_NAME, '@') - INSTR(A.OBJECT_NAME, '.') -1) END AS VARCHAR2(128)) AS TABLE_NAME, CAST(CASE WHEN INSTR(A.OBJECT_NAME, '@') = 0 THEN NULL ELSE SUBSTR(A.OBJECT_NAME, INSTR(A.OBJECT_NAME, '@')+1) END AS VARCHAR2(128)) AS DB_LINK FROM (SELECT BB.DATABASE_NAME, AA.SYNONYM_NAME, AA.OBJECT_NAME, AA.SYNONYM_ID FROM SYS.ALL_VIRTUAL_SYNONYM_REAL_AGENT AA, SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT BB WHERE AA.DATABASE_ID = BB.DATABASE_ID AND AA.TENANT_ID = BB.TENANT_ID AND AA.TENANT_ID = EFFECTIVE_TENANT_ID() AND (AA.DATABASE_ID = USERENV('SCHEMAID') OR USER_CAN_ACCESS_OBJ(13, AA.SYNONYM_ID, AA.DATABASE_ID) = 1)) A, (SELECT BB.DATABASE_NAME, AA.SYNONYM_ID FROM SYS.ALL_VIRTUAL_SYNONYM_REAL_AGENT AA, SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT BB WHERE AA.OBJECT_DATABASE_ID = BB.DATABASE_ID AND AA.TENANT_ID = BB.TENANT_ID AND AA.TENANT_ID = EFFECTIVE_TENANT_ID() AND (AA.DATABASE_ID = USERENV('SCHEMAID') OR USER_CAN_ACCESS_OBJ(13, AA.SYNONYM_ID, AA.DATABASE_ID) = 1)) B WHERE A.SYNONYM_ID = B.SYNONYM_ID NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS ALL_METHOD_PARAMS SELECT CAST(NULL AS VARCHAR2(30)) AS OWNER, CAST(NULL AS VARCHAR2(30)) AS TYPE_NAME, CAST(NULL AS VARCHAR2(30)) AS METHOD_NAME, CAST(NULL AS NUMBER) AS METHOD_NO, CAST(NULL AS VARCHAR2(30)) AS PARAM_NAME, CAST(NULL AS NUMBER) AS PARAM_NO, CAST(NULL AS VARCHAR2(6)) AS PARAM_MODE, CAST(NULL AS VARCHAR2(7)) AS PARAM_TYPE_MOD, CAST(NULL AS VARCHAR2(30)) AS PARAM_TYPE_OWNER, CAST(NULL AS VARCHAR2(30)) AS PARAM_TYPE_NAME, CAST(NULL AS VARCHAR2(44)) AS CHARACTER_SET_NAME FROM DUAL WHERE 1 = 0 NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS ALL_IND_SUBPARTITIONS SELECT CAST(B.INDEX_OWNER AS VARCHAR2(128)) AS INDEX_OWNER, CAST(B.INDEX_NAME AS VARCHAR2(128)) AS INDEX_NAME, CAST(PART.PART_NAME AS VARCHAR2(128)) AS PARTITION_NAME, CAST(SUB_PART.SUB_PART_NAME AS VARCHAR2(128)) AS SUBPARTITION_NAME, CAST(SUB_PART.HIGH_BOUND_VAL AS VARCHAR2(1024)) AS HIGH_VALUE, CAST(LENGTH(SUB_PART.HIGH_BOUND_VAL) AS NUMBER) AS HIGH_VALUE_LENGTH, SUB_PART.SUB_PART_ID + 1 AS SUBPARTITION_POSITION, CAST(NULL AS VARCHAR2(8)) AS STATUS, CAST(NULL AS VARCHAR2(30)) AS TABLESPACE_NAME, CAST(NULL AS NUMBER) AS PCT_FREE, CAST(NULL AS NUMBER) AS INI_TRANS, CAST(NULL AS NUMBER) AS MAX_TRANS, CAST(NULL AS NUMBER) AS INITIAL_EXTENT, CAST(NULL AS NUMBER) AS NEXT_EXTENT, CAST(NULL AS NUMBER) AS MIN_EXTENT, CAST(NULL AS NUMBER) AS MAX_EXTENT, CAST(NULL AS NUMBER) AS MAX_SIZE, CAST(NULL AS NUMBER) AS PCT_INCREASE, CAST(NULL AS NUMBER) AS FREELISTS, CAST(NULL AS NUMBER) AS FREELIST_GROUPS, CAST(NULL AS VARCHAR2(7)) AS LOGGING, CAST(CASE WHEN PART.COMPRESS_FUNC_NAME IS NULL THEN 'DISABLED' ELSE 'ENABLED' END AS VARCHAR2(8)) AS COMPRESSION, CAST(NULL AS NUMBER) AS BLEVEL, CAST(NULL AS NUMBER) AS LEAF_BLOCKS, CAST(NULL AS NUMBER) AS DISTINCT_KEYS, CAST(NULL AS NUMBER) AS AVG_LEAF_BLOCKS_PER_KEY, CAST(NULL AS NUMBER) AS AVG_DATA_BLOCKS_PER_KEY, CAST(NULL AS NUMBER) AS CLUSTERING_FACTOR, CAST(NULL AS NUMBER) AS NUM_ROWS, CAST(NULL AS NUMBER) AS SAMPLE_SIZE, CAST(NULL AS DATE) AS LAST_ANALYZED, CAST(NULL AS VARCHAR2(7)) AS BUFFER_POOL, CAST(NULL AS VARCHAR2(7)) AS FLASH_CACHE, CAST(NULL AS VARCHAR2(7)) AS CELL_FLASH_CACHE, CAST(NULL AS VARCHAR2(3)) AS USER_STATS, CAST(NULL AS NUMBER) AS PCT_DIRECT_ACCESS, CAST(NULL AS VARCHAR2(3)) AS GLOBAL_STATS, CAST(NULL AS VARCHAR2(6)) AS DOMIDX_OPSTATUS, CAST(NULL AS VARCHAR2(1000)) AS PARAMETERS, CAST(NULL AS VARCHAR2(3)) AS INTERVAL, CAST(NULL AS VARCHAR2(3)) AS SEGMENT_CREATED FROM( SELECT A.INDEX_OWNER AS INDEX_OWNER, A.INDEX_NAME AS INDEX_NAME, A.INDEX_TABLE_ID AS TABLE_ID, /*INDEX TABLE ID*/ A.DATA_TABLE_ID AS DATA_TABLE_ID, A.PART_LEVEL AS INDEX_TABLE_PART_LEVEL, TB2.PART_LEVEL AS DATA_TABLE_PART_LEVEL, /* CAST(CASE WHEN A.PART_LEVEL=2 THEN 'FALSE' ELSE 'TRUE' END AS VARCHAR2(5)) IS_LOCAL */ CAST('TRUE' AS VARCHAR2(5)) AS IS_LOCAL FROM( SELECT DB.DATABASE_NAME AS INDEX_OWNER, SUBSTR(TB1.TABLE_NAME, 7 + INSTR(SUBSTR(TB1.TABLE_NAME, 7), '_')) AS INDEX_NAME, TB1.TABLE_ID AS INDEX_TABLE_ID, TB1.DATA_TABLE_ID AS DATA_TABLE_ID, TB1.INDEX_TYPE AS INDEX_TYPE, TB1.PART_LEVEL AS PART_LEVEL /*USE DATA TABLE'S PART_LEVEL IF INDEX IS LOCAL INDEX*/ FROM SYS.ALL_VIRTUAL_TABLE_REAL_AGENT TB1, SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT DB WHERE DB.DATABASE_NAME!='__recyclebin' AND TB1.DATABASE_ID=DB.DATABASE_ID AND TB1.TABLE_TYPE=5 AND TB1.TENANT_ID = EFFECTIVE_TENANT_ID() AND DB.TENANT_ID = EFFECTIVE_TENANT_ID() AND (TB1.DATABASE_ID = USERENV('SCHEMAID') OR USER_CAN_ACCESS_OBJ(1, TB1.DATA_TABLE_ID, TB1.DATABASE_ID) = 1) ) A JOIN SYS.ALL_VIRTUAL_TABLE_REAL_AGENT TB2 ON A.DATA_TABLE_ID=TB2.TABLE_ID AND TB2.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE A.PART_LEVEL=2 OR ((A.INDEX_TYPE=1 OR A.INDEX_TYPE=2) AND TB2.PART_LEVEL=2) ) B, SYS.ALL_VIRTUAL_PART_REAL_AGENT PART, SYS.ALL_VIRTUAL_SUB_PART_REAL_AGENT SUB_PART WHERE ((B.IS_LOCAL='FALSE' AND B.TABLE_ID=PART.TABLE_ID AND PART.TABLE_ID=SUB_PART.TABLE_ID AND PART.PART_ID=SUB_PART.PART_ID) OR (B.IS_LOCAL='TRUE' AND B.DATA_TABLE_ID=PART.TABLE_ID AND PART.TABLE_ID=SUB_PART.TABLE_ID AND PART.PART_ID=SUB_PART.PART_ID)) AND SUB_PART.TENANT_ID = EFFECTIVE_TENANT_ID() AND PART.TENANT_ID = EFFECTIVE_TENANT_ID() NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS ALL_IND_PARTITIONS SELECT CAST(B.INDEX_OWNER AS VARCHAR2(128)) AS INDEX_OWNER, CAST(B.INDEX_NAME AS VARCHAR2(128)) AS INDEX_NAME, CAST(CASE WHEN PART.SUB_PART_NUM <=0 THEN 'NO' ELSE 'YES' END AS VARCHAR(3)) AS COMPOSITE, CAST(PART.PART_NAME AS VARCHAR2(128)) AS PARTITION_NAME, PART.SUB_PART_NUM AS SUBPARTITION_COUNT, CAST(PART.HIGH_BOUND_VAL AS VARCHAR2(1024)) AS HIGH_VALUE, CAST(LENGTH(PART.HIGH_BOUND_VAL) AS NUMBER) AS HIGH_VALUE_LENGTH, PART.PART_ID + 1 AS PARTITION_POSITION, CAST(NULL AS VARCHAR2(8)) AS STATUS, CAST(NULL AS VARCHAR2(30)) AS TABLESPACE_NAME, CAST(NULL AS NUMBER) AS PCT_FREE, CAST(NULL AS NUMBER) AS INI_TRANS, CAST(NULL AS NUMBER) AS MAX_TRANS, CAST(NULL AS NUMBER) AS INITIAL_EXTENT, CAST(NULL AS NUMBER) AS NEXT_EXTENT, CAST(NULL AS NUMBER) AS MIN_EXTENT, CAST(NULL AS NUMBER) AS MAX_EXTENT, CAST(NULL AS NUMBER) AS MAX_SIZE, CAST(NULL AS NUMBER) AS PCT_INCREASE, CAST(NULL AS NUMBER) AS FREELISTS, CAST(NULL AS NUMBER) AS FREELIST_GROUPS, CAST(NULL AS VARCHAR2(7)) AS LOGGING, CAST(CASE WHEN PART.COMPRESS_FUNC_NAME IS NULL THEN 'DISABLED' ELSE 'ENABLED' END AS VARCHAR2(8)) AS COMPRESSION, CAST(NULL AS NUMBER) AS BLEVEL, CAST(NULL AS NUMBER) AS LEAF_BLOCKS, CAST(NULL AS NUMBER) AS DISTINCT_KEYS, CAST(NULL AS NUMBER) AS AVG_LEAF_BLOCKS_PER_KEY, CAST(NULL AS NUMBER) AS AVG_DATA_BLOCKS_PER_KEY, CAST(NULL AS NUMBER) AS CLUSTERING_FACTOR, CAST(NULL AS NUMBER) AS NUM_ROWS, CAST(NULL AS NUMBER) AS SAMPLE_SIZE, CAST(NULL AS DATE) AS LAST_ANALYZED, CAST(NULL AS VARCHAR2(7)) AS BUFFER_POOL, CAST(NULL AS VARCHAR2(7)) AS FLASH_CACHE, CAST(NULL AS VARCHAR2(7)) AS CELL_FLASH_CACHE, CAST(NULL AS VARCHAR2(3)) AS USER_STATS, CAST(NULL AS NUMBER) AS PCT_DIRECT_ACCESS, CAST(NULL AS VARCHAR2(3)) AS GLOBAL_STATS, CAST(NULL AS VARCHAR2(6)) AS DOMIDX_OPSTATUS, CAST(NULL AS VARCHAR2(1000)) AS PARAMETERS, CAST(NULL AS VARCHAR2(3)) AS INTERVAL, CAST(NULL AS VARCHAR2(3)) AS SEGMENT_CREATED FROM( SELECT A.INDEX_OWNER AS INDEX_OWNER, A.INDEX_NAME AS INDEX_NAME, A.INDEX_TABLE_ID AS TABLE_ID, /*INDEX TABLE ID*/ A.DATA_TABLE_ID AS DATA_TABLE_ID, CAST(CASE WHEN A.PART_LEVEL=1 THEN 'FALSE' ELSE 'TRUE' END AS VARCHAR2(5)) IS_LOCAL FROM( SELECT DB.DATABASE_NAME AS INDEX_OWNER, SUBSTR(TB1.TABLE_NAME, 7 + INSTR(SUBSTR(TB1.TABLE_NAME, 7), '_')) AS INDEX_NAME, TB1.TABLE_ID AS INDEX_TABLE_ID, TB1.DATA_TABLE_ID AS DATA_TABLE_ID, TB1.INDEX_TYPE AS INDEX_TYPE, TB1.PART_LEVEL AS PART_LEVEL /*USE DATA TABLE'S PART_LEVEL IF INDEX IS LOCAL INDEX*/ FROM SYS.ALL_VIRTUAL_TABLE_REAL_AGENT TB1, SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT DB WHERE DB.DATABASE_NAME!='__recyclebin' AND TB1.DATABASE_ID=DB.DATABASE_ID AND TB1.TABLE_TYPE=5 AND TB1.TENANT_ID = EFFECTIVE_TENANT_ID() AND DB.TENANT_ID = EFFECTIVE_TENANT_ID() AND (TB1.DATABASE_ID = USERENV('SCHEMAID') OR USER_CAN_ACCESS_OBJ(1, TB1.DATA_TABLE_ID, TB1.DATABASE_ID) = 1) ) A JOIN SYS.ALL_VIRTUAL_TABLE_REAL_AGENT TB2 ON A.DATA_TABLE_ID=TB2.TABLE_ID AND TB2.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE A.PART_LEVEL=1 OR ((A.INDEX_TYPE=1 OR A.INDEX_TYPE=2) AND TB2.PART_LEVEL=1) ) B JOIN SYS.ALL_VIRTUAL_PART_REAL_AGENT PART ON ((B.TABLE_ID=PART.TABLE_ID AND B.IS_LOCAL='FALSE') OR (B.DATA_TABLE_ID=PART.TABLE_ID AND B.IS_LOCAL='TRUE')) AND PART.TENANT_ID = EFFECTIVE_TENANT_ID() NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS ALL_IND_EXPRESSIONS SELECT CAST(INDEX_OWNER AS VARCHAR2(128)) AS INDEX_OWNER, CAST(INDEX_NAME AS VARCHAR2(128)) AS INDEX_NAME, CAST(TABLE_OWNER AS VARCHAR2(128)) AS TABLE_OWNER, CAST(H.TABLE_NAME AS VARCHAR2(128)) AS TABLE_NAME, CAST(COLUMN_EXPRESSION /* TODO: LONG */ AS VARCHAR2(1000)) AS COLUMN_EXPRESSION, COLUMN_POSITION FROM ( SELECT INDEX_OWNER, INDEX_NAME, TABLE_OWNER, F.CUR_DEFAULT_VALUE_V2 AS COLUMN_EXPRESSION, E.INDEX_POSITION AS COLUMN_POSITION, E.TABLE_ID AS TABLE_ID FROM (SELECT INDEX_OWNER, INDEX_NAME, TABLE_OWNER, C.TABLE_ID AS TABLE_ID, C.INDEX_ID AS INDEX_ID, D.COLUMN_ID AS COLUMN_ID, D.COLUMN_NAME AS COLUMN_NAME, D.INDEX_POSITION AS INDEX_POSITION FROM (SELECT DATABASE_NAME AS INDEX_OWNER, SUBSTR(TABLE_NAME, 7 + INSTR(SUBSTR(TABLE_NAME, 7), '_')) AS INDEX_NAME, DATABASE_NAME AS TABLE_OWNER, A.DATA_TABLE_ID AS TABLE_ID, A.TABLE_ID AS INDEX_ID FROM SYS.ALL_VIRTUAL_TABLE_REAL_AGENT A JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT B ON A.DATABASE_ID = B.DATABASE_ID AND A.TENANT_ID = EFFECTIVE_TENANT_ID() AND B.TENANT_ID = EFFECTIVE_TENANT_ID() AND (A.DATABASE_ID = USERENV('SCHEMAID') OR USER_CAN_ACCESS_OBJ(1, A.DATA_TABLE_ID, A.DATABASE_ID) = 1) AND B.DATABASE_NAME != '__recyclebin' WHERE TABLE_TYPE=5 ) C JOIN SYS.ALL_VIRTUAL_COLUMN_REAL_AGENT D ON C.INDEX_ID=D.TABLE_ID AND D.TENANT_ID = EFFECTIVE_TENANT_ID()) E JOIN SYS.ALL_VIRTUAL_COLUMN_REAL_AGENT F ON F.TABLE_ID=E.TABLE_ID AND F.TENANT_ID = EFFECTIVE_TENANT_ID() AND F.COLUMN_ID=E.COLUMN_ID AND F.COLUMN_FLAGS=1) G JOIN SYS.ALL_VIRTUAL_TABLE_REAL_AGENT H ON G.TABLE_ID=H.TABLE_ID AND H.TENANT_ID = EFFECTIVE_TENANT_ID() NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS ALL_IND_EXPRESSIONS SELECT CAST(INDEX_OWNER AS VARCHAR2(128)) AS INDEX_OWNER, CAST(INDEX_NAME AS VARCHAR2(128)) AS INDEX_NAME, CAST(TABLE_OWNER AS VARCHAR2(128)) AS TABLE_OWNER, CAST(H.TABLE_NAME AS VARCHAR2(128)) AS TABLE_NAME, CAST(COLUMN_EXPRESSION /* TODO: LONG */ AS VARCHAR2(1000)) AS COLUMN_EXPRESSION, COLUMN_POSITION FROM ( SELECT INDEX_OWNER, INDEX_NAME, TABLE_OWNER, F.CUR_DEFAULT_VALUE_V2 AS COLUMN_EXPRESSION, E.INDEX_POSITION AS COLUMN_POSITION, E.TABLE_ID AS TABLE_ID FROM (SELECT INDEX_OWNER, INDEX_NAME, TABLE_OWNER, C.TABLE_ID AS TABLE_ID, C.INDEX_ID AS INDEX_ID, D.COLUMN_ID AS COLUMN_ID, D.COLUMN_NAME AS COLUMN_NAME, D.INDEX_POSITION AS INDEX_POSITION FROM (SELECT DATABASE_NAME AS INDEX_OWNER, SUBSTR(TABLE_NAME, 7 + INSTR(SUBSTR(TABLE_NAME, 7), '_')) AS INDEX_NAME, DATABASE_NAME AS TABLE_OWNER, A.DATA_TABLE_ID AS TABLE_ID, A.TABLE_ID AS INDEX_ID FROM SYS.ALL_VIRTUAL_TABLE_REAL_AGENT A JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT B ON A.DATABASE_ID = B.DATABASE_ID AND A.TENANT_ID = EFFECTIVE_TENANT_ID() AND B.TENANT_ID = EFFECTIVE_TENANT_ID() AND (A.DATABASE_ID = USERENV('SCHEMAID') OR USER_CAN_ACCESS_OBJ(1, A.DATA_TABLE_ID, A.DATABASE_ID) = 1) AND B.DATABASE_NAME != '__recyclebin' WHERE TABLE_TYPE=5 ) C JOIN SYS.ALL_VIRTUAL_COLUMN_REAL_AGENT D ON C.INDEX_ID=D.TABLE_ID AND D.TENANT_ID = EFFECTIVE_TENANT_ID() AND D.INDEX_POSITION != 0) E JOIN SYS.ALL_VIRTUAL_COLUMN_REAL_AGENT F ON F.TABLE_ID=E.TABLE_ID AND F.TENANT_ID = EFFECTIVE_TENANT_ID() AND F.COLUMN_ID=E.COLUMN_ID AND BITAND(F.COLUMN_FLAGS,3) > 0) G JOIN SYS.ALL_VIRTUAL_TABLE_REAL_AGENT H ON G.TABLE_ID=H.TABLE_ID AND H.TENANT_ID = EFFECTIVE_TENANT_ID() NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS ALL_IND_COLUMNS SELECT CAST(INDEX_OWNER AS VARCHAR2(128)) AS INDEX_OWNER, CAST(INDEX_NAME AS VARCHAR2(128)) AS INDEX_NAME, CAST(TABLE_OWNER AS VARCHAR2(128)) AS TABLE_OWNER, CAST(TABLE_NAME AS VARCHAR2(128)) AS TABLE_NAME, CAST(COLUMN_NAME AS VARCHAR2(4000)) AS COLUMN_NAME, CAST(ROWKEY_POSITION AS NUMBER) AS COLUMN_POSITION, CASE WHEN DATA_TYPE >= 1 AND DATA_TYPE <= 16 THEN CAST(22 AS NUMBER) WHEN DATA_TYPE = 17 THEN CAST(7 AS NUMBER) WHEN DATA_TYPE IN (22, 23) AND F.DATA_PRECISION = 2 THEN CAST(DATA_LENGTH AS NUMBER) WHEN DATA_TYPE IN (22, 23) AND F.DATA_PRECISION = 1 AND F.COLLATION_TYPE IN (45, 46, 224, 54, 55, 101) THEN CAST(DATA_LENGTH * 4 AS NUMBER) WHEN DATA_TYPE IN (22, 23) AND F.DATA_PRECISION = 1 AND F.COLLATION_TYPE IN (28, 87) THEN CAST(DATA_LENGTH * 2 AS NUMBER) WHEN DATA_TYPE = 36 THEN CAST(12 AS NUMBER) WHEN DATA_TYPE IN (37, 38) THEN CAST(11 AS NUMBER) WHEN DATA_TYPE = 39 THEN CAST(DATA_LENGTH AS NUMBER) WHEN DATA_TYPE = 40 THEN CAST(5 AS NUMBER) WHEN DATA_TYPE = 41 THEN CAST(11 AS NUMBER) ELSE CAST(0 AS NUMBER) END AS COLUMN_LENGTH, CASE WHEN DATA_TYPE IN (22, 23) THEN CAST(DATA_LENGTH AS NUMBER) ELSE CAST(0 AS NUMBER) END AS CHAR_LENGTH, CAST('ASC' AS VARCHAR2(4)) AS DESCEND FROM (SELECT INDEX_OWNER, INDEX_NAME, TABLE_OWNER, TABLE_NAME, INDEX_ID, IDX_TYPE FROM (SELECT DATABASE_NAME AS INDEX_OWNER, CASE WHEN (TABLE_TYPE = 5) THEN SUBSTR(TABLE_NAME, 7 + INSTR(SUBSTR(TABLE_NAME, 7), '_')) ELSE (CONS_TAB.CONSTRAINT_NAME) END AS INDEX_NAME, DATABASE_NAME AS TABLE_OWNER, CASE WHEN (TABLE_TYPE = 3) THEN A.TABLE_ID ELSE A.DATA_TABLE_ID END AS TABLE_ID, A.TABLE_ID AS INDEX_ID, TABLE_TYPE AS IDX_TYPE FROM SYS.ALL_VIRTUAL_TABLE_REAL_AGENT A JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT B ON A.DATABASE_ID = B.DATABASE_ID AND TABLE_TYPE IN (5, 3) AND B.DATABASE_NAME != '__recyclebin' AND A.TENANT_ID = EFFECTIVE_TENANT_ID() AND B.TENANT_ID = EFFECTIVE_TENANT_ID() AND (A.DATABASE_ID = USERENV('SCHEMAID') OR USER_CAN_ACCESS_OBJ(1, DECODE(TABLE_TYPE, 3, TABLE_ID, 5, DATA_TABLE_ID), A.DATABASE_ID) = 1) LEFT JOIN SYS.ALL_VIRTUAL_CONSTRAINT_REAL_AGENT CONS_TAB ON (CONS_TAB.TABLE_ID = A.TABLE_ID AND CONS_TAB.TENANT_ID = EFFECTIVE_TENANT_ID()) WHERE NOT( TABLE_TYPE = 3 AND CONSTRAINT_NAME IS NULL ) ) C JOIN SYS.ALL_VIRTUAL_TABLE_REAL_AGENT D ON C.TABLE_ID = D.TABLE_ID AND D.TENANT_ID = EFFECTIVE_TENANT_ID() ) E JOIN SYS.ALL_VIRTUAL_COLUMN_REAL_AGENT F ON E.INDEX_ID = F.TABLE_ID AND F.TENANT_ID = EFFECTIVE_TENANT_ID() WHERE F.ROWKEY_POSITION != 0 AND (CASE WHEN IDX_TYPE = 5 THEN INDEX_POSITION ELSE 1 END) != 0 NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS ALL_INDEXES SELECT CAST(INDEX_OWNER AS VARCHAR2(128)) AS OWNER, CAST(INDEX_NAME AS VARCHAR2(128)) AS INDEX_NAME, CAST(INDEX_TYPE_NAME AS VARCHAR2(27)) AS INDEX_TYPE, CAST(TABLE_OWNER AS VARCHAR2(128)) AS TABLE_OWNER, CAST(TABLE_NAME AS VARCHAR2(128)) AS TABLE_NAME, CAST('TABLE' AS CHAR(5)) AS TABLE_TYPE, CAST(UNIQUENESS AS VARCHAR2(9)) AS UNIQUENESS, CAST(COMPRESSION AS VARCHAR2(8)) AS COMPRESSION, CAST(NULL AS NUMBER) AS PREFIX_LENGTH, CAST(TP.TABLESPACE_NAME AS VARCHAR2(30)) AS TABLESPACE_NAME, CAST(NULL AS NUMBER) AS INI_TRANS, CAST(NULL AS NUMBER) AS MAX_TRANS, CAST(NULL AS NUMBER) AS INITIAL_EXTENT, CAST(NULL AS NUMBER) AS NEXT_EXTENT, CAST(NULL AS NUMBER) AS MIN_EXTENTS, CAST(NULL AS NUMBER) AS MAX_EXTENTS, CAST(NULL AS NUMBER) AS PCT_INCREASE, CAST(NULL AS NUMBER) AS PCT_THRESHOLD, CAST(NULL AS NUMBER) AS INCLUDE_COLUMN, CAST(NULL AS NUMBER) AS FREELISTS, CAST(NULL AS NUMBER) AS FREELIST_GROUPS, CAST(NULL AS NUMBER) AS PCT_FREE, CAST(NULL AS VARCHAR2(3)) AS LOGGING, CAST(NULL AS NUMBER) AS BLEVEL, CAST(NULL AS NUMBER) AS LEAF_BLOCKS, CAST(NULL AS NUMBER) AS DISTINCT_KEYS, CAST(NULL AS NUMBER) AS AVG_LEAF_BLOCKS_PER_KEY, CAST(NULL AS NUMBER) AS AVG_DATA_BLOCKS_PER_KEY, CAST(NULL AS NUMBER) AS CLUSTERING_FACTOR, CAST(STATUS AS VARCHAR2(10)) AS STATUS, CAST(NULL AS NUMBER) AS NUM_ROWS, CAST(NULL AS NUMBER) AS SAMPLE_SIZE, CAST(NULL AS DATE) AS LAST_ANALYZED, CAST(NULL AS VARCHAR2(40)) AS DEGREE, CAST(NULL AS VARCHAR2(40)) AS INSTANCES, CAST(CASE WHEN A_TABLE_TYPE = 3 THEN 'NO' WHEN A_INDEX_TYPE = 1 OR A_INDEX_TYPE = 2 THEN (CASE WHEN D.PART_LEVEL = 0 THEN 'NO' ELSE 'YES' END) ELSE (CASE WHEN A_PART_LEVEL = 0 THEN 'NO' ELSE 'YES' END) END AS VARCHAR2(3)) AS PARTITIONED, CAST(NULL AS VARCHAR2(1)) AS TEMPORARY, CAST(NULL AS VARCHAR2(1)) AS "GENERATED", CAST(NULL AS VARCHAR2(1)) AS SECONDARY, CAST(NULL AS VARCHAR2(7)) AS BUFFER_POOL, CAST(NULL AS VARCHAR2(7)) AS FLASH_CACHE, CAST(NULL AS VARCHAR2(7)) AS CELL_FLASH_CACHE, CAST(NULL AS VARCHAR2(3)) AS USER_STATS, CAST(NULL AS VARCHAR2(15)) AS DURATION, CAST(NULL AS NUMBER) AS PCT_DIRECT_ACCESS, CAST(NULL AS VARCHAR2(30)) AS ITYP_OWNER, CAST(NULL AS VARCHAR2(30)) AS ITYP_NAME, CAST(NULL AS VARCHAR2(1000)) AS PARAMETERS, CAST(NULL AS VARCHAR2(3)) AS GLOBAL_STATS, CAST(NULL AS VARCHAR2(12)) AS DOMIDX_STATUS, CAST(NULL AS VARCHAR2(6)) AS DOMIDX_OPSTATUS, CAST(FUNCIDX_STATUS AS VARCHAR2(8)) AS FUNCIDX_STATUS, CAST('NO' AS VARCHAR2(3)) AS JOIN_INDEX, CAST(NULL AS VARCHAR2(3)) AS IOT_REDUNDANT_PKEY_ELIM, CAST(DROPPED AS VARCHAR2(9)) AS DROPPED, CAST(VISIBILITY AS VARCHAR2(10)) AS VISIBILITY, CAST(NULL AS VARCHAR2(14)) AS DOMIDX_MANAGEMENT, CAST(NULL AS VARCHAR2(3)) AS SEGMENT_CREATED FROM (SELECT DATABASE_NAME AS INDEX_OWNER, CASE WHEN (TABLE_TYPE = 5 AND B.DATABASE_NAME != '__recyclebin') THEN SUBSTR(TABLE_NAME, 7 + INSTR(SUBSTR(TABLE_NAME, 7), '_')) WHEN (TABLE_TYPE = 5 AND B.DATABASE_NAME = '__recyclebin') THEN TABLE_NAME ELSE (CONS_TAB.CONSTRAINT_NAME) END AS INDEX_NAME, CASE WHEN A.TABLE_TYPE = 5 AND EXISTS ( SELECT 1 FROM SYS.ALL_VIRTUAL_COLUMN_REAL_AGENT T_COL_INDEX, SYS.ALL_VIRTUAL_COLUMN_REAL_AGENT T_COL_BASE WHERE T_COL_BASE.TABLE_ID = A.DATA_TABLE_ID AND T_COL_BASE.COLUMN_NAME = T_COL_INDEX.COLUMN_NAME AND T_COL_INDEX.TABLE_ID = A.TABLE_ID AND T_COL_BASE.TENANT_ID = A.TENANT_ID AND T_COL_INDEX.TENANT_ID = A.TENANT_ID AND BITAND(T_COL_BASE.COLUMN_FLAGS,3) > 0 ) THEN 'FUNCTION-BASED NORMAL' ELSE 'NORMAL' END AS INDEX_TYPE_NAME, DATABASE_NAME AS TABLE_OWNER, CASE WHEN (TABLE_TYPE = 3) THEN A.TABLE_ID ELSE A.DATA_TABLE_ID END AS TABLE_ID, A.TABLE_ID AS INDEX_ID, CASE WHEN TABLE_TYPE = 3 THEN 'UNIQUE' WHEN A.INDEX_TYPE IN (2, 4, 8) THEN 'UNIQUE' ELSE 'NONUNIQUE' END AS UNIQUENESS, CASE WHEN A.COMPRESS_FUNC_NAME = NULL THEN 'DISABLED' ELSE 'ENABLED' END AS COMPRESSION, CASE WHEN TABLE_TYPE = 3 THEN 'VALID' WHEN A.INDEX_STATUS = 2 THEN 'VALID' WHEN A.INDEX_STATUS = 3 THEN 'CHECKING' WHEN A.INDEX_STATUS = 4 THEN 'INELEGIBLE' WHEN A.INDEX_STATUS = 5 THEN 'ERROR' ELSE 'UNUSABLE' END AS STATUS, A.INDEX_TYPE AS A_INDEX_TYPE, A.PART_LEVEL AS A_PART_LEVEL, A.TABLE_TYPE AS A_TABLE_TYPE, CASE WHEN 0 = (SELECT COUNT(1) FROM SYS.ALL_VIRTUAL_COLUMN_REAL_AGENT WHERE TABLE_ID = A.TABLE_ID AND IS_HIDDEN = 0 AND TENANT_ID = EFFECTIVE_TENANT_ID()) THEN 'ENABLED' ELSE 'NULL' END AS FUNCIDX_STATUS, CASE WHEN B.DATABASE_NAME = '__recyclebin' THEN 'YES' ELSE 'NO' END AS DROPPED, CASE WHEN BITAND(A.INDEX_ATTRIBUTES_SET, 1) = 0 THEN 'VISIBLE' ELSE 'INVISIBLE' END AS VISIBILITY, A.TABLESPACE_ID FROM SYS.ALL_VIRTUAL_TABLE_REAL_AGENT A JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT B ON A.DATABASE_ID = B.DATABASE_ID AND A.TENANT_ID = EFFECTIVE_TENANT_ID() AND B.TENANT_ID = EFFECTIVE_TENANT_ID() AND (A.DATABASE_ID = USERENV('SCHEMAID') OR USER_CAN_ACCESS_OBJ(1, DECODE(TABLE_TYPE, 3, A.TABLE_ID, 5, DATA_TABLE_ID), A.DATABASE_ID) = 1) AND TABLE_TYPE IN (5, 3) LEFT JOIN SYS.ALL_VIRTUAL_CONSTRAINT_REAL_AGENT CONS_TAB ON (CONS_TAB.TABLE_ID = A.TABLE_ID AND CONS_TAB.TENANT_ID = EFFECTIVE_TENANT_ID()) WHERE NOT(TABLE_TYPE = 3 AND CONSTRAINT_NAME IS NULL) AND (CONS_TAB.CONSTRAINT_TYPE IS NULL OR CONS_TAB.CONSTRAINT_TYPE = 1) ) C JOIN SYS.ALL_VIRTUAL_TABLE_REAL_AGENT D ON C.TABLE_ID = D.TABLE_ID AND D.TENANT_ID = EFFECTIVE_TENANT_ID() LEFT JOIN SYS.ALL_VIRTUAL_TENANT_TABLESPACE_REAL_AGENT TP ON C.TABLESPACE_ID = TP.TABLESPACE_ID AND TP.TENANT_ID = EFFECTIVE_TENANT_ID() NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
def SYS ALL_ERRORS SELECT CAST(o.owner AS VARCHAR2(128)) AS OWNER, CAST(o.object_name AS VARCHAR2(128)) AS NAME, CAST(o.object_type AS VARCHAR2(19)) AS TYPE, CAST(e.obj_seq AS NUMBER) AS SEQUENCE, CAST(e.line AS NUMBER) AS LINE, CAST(e.position AS NUMBER) AS POSITION, CAST(e.text as VARCHAR2(4000)) AS TEXT, CAST(DECODE(e.property, 0, 'ERROR', 1, 'WARNING', 'UNDEFINED') AS VARCHAR2(9)) AS ATTRIBUTE, CAST(e.error_number AS NUMBER) AS MESSAGE_NUMBER FROM all_objects o, (select obj_id, obj_seq, line, position, text, property, error_number, CAST( UPPER(decode(obj_type, 3, 'PACKAGE', 4, 'TYPE', 5, 'PACKAGE BODY', 6, 'TYPE BODY', 7, 'TRIGGER', 8, 'VIEW', 9, 'FUNCTION', 12, 'PROCEDURE', 'MAXTYPE')) AS VARCHAR2(23)) object_type from sys.ALL_VIRTUAL_TENANT_ERROR_REAL_AGENT WHERE TENANT_ID = EFFECTIVE_TENANT_ID()) e WHERE o.object_id = e.obj_id AND o.object_type like e.object_type AND o.object_type IN (UPPER('package'), UPPER('type'), UPPER('procedure'), UPPER('function'), UPPER('package body'), UPPER('view'), UPPER('trigger'), UPPER('type body'), UPPER('library'), UPPER('queue'), UPPER('java source'), UPPER('java class'), UPPER('dimension'), UPPER('assembly'), UPPER('hierarchy'), UPPER('arrtibute dimension'), UPPER('analytic view')) NONE NO NONE NONE utf8mb4 utf8mb4_general_ci
VIEWS CREATE VIEW `VIEWS` AS select /*+ READ_CONSISTENCY(WEAK) */ 'def' AS TABLE_CATALOG, d.database_name as TABLE_SCHEMA, t.table_name as TABLE_NAME, t.view_definition as VIEW_DEFINITION, 'NONE' as CHECK_OPTION, case t.view_is_updatable when 1 then 'YES' else 'NO' end as IS_UPDATABLE, 'NONE' as DEFINER, 'NONE' AS SECURITY_TYPE, case t.collation_type when 45 then 'utf8mb4' else 'NONE' end AS CHARACTER_SET_CLIENT, case t.collation_type when 45 then 'utf8mb4_general_ci' else 'NONE' end AS COLLATION_CONNECTION from oceanbase.__all_virtual_table as t join oceanbase.__all_virtual_database as d on t.tenant_id = effective_tenant_id() and d.tenant_id = effective_tenant_id() and t.database_id = d.database_id where (t.table_type = 1 or t.table_type = 4) and d.in_recyclebin = 0 and d.database_name != '__recyclebin' and d.database_name != 'information_schema' and d.database_name != 'oceanbase' utf8mb4 utf8mb4_general_ci
VIEWS CREATE VIEW `VIEWS` AS select /*+ READ_CONSISTENCY(WEAK) */ 'def' AS TABLE_CATALOG, d.database_name as TABLE_SCHEMA, t.table_name as TABLE_NAME, t.view_definition as VIEW_DEFINITION, 'NONE' as CHECK_OPTION, case t.view_is_updatable when 1 then 'YES' else 'NO' end as IS_UPDATABLE, 'NONE' as DEFINER, 'NONE' AS SECURITY_TYPE, case t.collation_type when 45 then 'utf8mb4' else 'NONE' end AS CHARACTER_SET_CLIENT, case t.collation_type when 45 then 'utf8mb4_general_ci' else 'NONE' end AS COLLATION_CONNECTION from oceanbase.__all_virtual_table as t join oceanbase.__all_virtual_database as d on t.tenant_id = effective_tenant_id() and d.tenant_id = effective_tenant_id() and t.database_id = d.database_id where (t.table_type = 1 or t.table_type = 4) and d.in_recyclebin = 0 and d.database_name != '__recyclebin' and d.database_name != 'information_schema' and d.database_name != 'oceanbase' and 0 = sys_privilege_check('table_acc', effective_tenant_id(), d.database_name, t.table_name) utf8mb4 utf8mb4_general_ci
select !w, !!w, !(!w), ! !w, not w, not not w, w is true, w is not false, (not w) is false, not(w is false), if(w,'true','false'), !1+1, !'a', !false, !isnull('a'), !!isnull('a') from (select 0 w union select 1) w;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def !w !w 8 1 1 N 32897 0 63
def !!w !!w 8 1 1 N 32897 0 63
def !(!w) !(!w) 8 1 1 N 32897 0 63
def ! !w ! !w 8 1 1 N 32897 0 63
def not w not w 8 1 1 N 32897 0 63
def not not w not not w 8 1 1 N 32897 0 63
def !w !w 8 1 1 Y 32896 0 63
def !!w !!w 8 1 1 Y 32896 0 63
def !(!w) !(!w) 8 1 1 Y 32896 0 63
def ! !w ! !w 8 1 1 Y 32896 0 63
def not w not w 8 1 1 Y 32896 0 63
def not not w not not w 8 1 1 Y 32896 0 63
def w is true w is true 3 1 1 N 32897 0 63
def w is not false w is not false 3 1 1 N 32897 0 63
def (not w) is false (not w) is false 3 1 1 N 32897 0 63
create view v1 as select /*+ leading(c, b , a ) use_hash(b a) */ a.c1 as a_c1, a.c2 as a_c2, a.c3 as a_c3, b.d1, b.d2, b.d3, c.c1 as c_c1, c.c2 as c_c2, c.c3 as c_c3 from nn1 a join nn2 b on a.c1 = b.d2 join nn1 c on b.d1 = c.c1 where a.c2 < 5;
v1 CREATE VIEW `v1` AS select /*+ LEADING(c b a) USE_HASH((b) (a)) */`bushy_leading_hint_db`.`a`.`c1` AS `a_c1`,`bushy_leading_hint_db`.`a`.`c2` AS `a_c2`,`bushy_leading_hint_db`.`a`.`c3` AS `a_c3`,`bushy_leading_hint_db`.`b`.`d1` AS `d1`,`bushy_leading_hint_db`.`b`.`d2` AS `d2`,`bushy_leading_hint_db`.`b`.`d3` AS `d3`,`bushy_leading_hint_db`.`c`.`c1` AS `c_c1`,`bushy_leading_hint_db`.`c`.`c2` AS `c_c2`,`bushy_leading_hint_db`.`c`.`c3` AS `c_c3` from ((`bushy_leading_hint_db`.`nn1` `a` join `bushy_leading_hint_db`.`nn2` `b` on ((`bushy_leading_hint_db`.`a`.`c1` = `bushy_leading_hint_db`.`b`.`d2`))) join `bushy_leading_hint_db`.`nn1` `c` on ((`bushy_leading_hint_db`.`b`.`d1` = `bushy_leading_hint_db`.`c`.`c1`))) where (`bushy_leading_hint_db`.`a`.`c2` < 5) utf8mb4 utf8mb4_general_ci
v1 CREATE VIEW `v1` AS select /*+ LEADING(c b a) USE_HASH((b) (a)) */`a`.`c1` AS `a_c1`,`a`.`c2` AS `a_c2`,`a`.`c3` AS `a_c3`,`b`.`d1` AS `d1`,`b`.`d2` AS `d2`,`b`.`d3` AS `d3`,`c`.`c1` AS `c_c1`,`c`.`c2` AS `c_c2`,`c`.`c3` AS `c_c3` from ((`bushy_leading_hint_db`.`nn1` `a` join `bushy_leading_hint_db`.`nn2` `b` on ((`a`.`c1` = `b`.`d2`))) join `bushy_leading_hint_db`.`nn1` `c` on ((`b`.`d1` = `c`.`c1`))) where (`a`.`c2` < 5) utf8mb4 utf8mb4_general_ci
create view v2 as select /*+ leading(c, (b , a)) */ a.c1 as a_c1, a.c2 as a_c2, a.c3 as a_c3, b.d1, b.d2, b.d3, c.c1 as c_c1, c.c2 as c_c2, c.c3 as c_c3 from nn1 a join nn2 b on a.c1 = b.d2 join nn1 c on b.d1 = c.c1 where a.c2 < 5 ;
v2 CREATE VIEW `v2` AS select /*+ LEADING(c (b a)) */`bushy_leading_hint_db`.`a`.`c1` AS `a_c1`,`bushy_leading_hint_db`.`a`.`c2` AS `a_c2`,`bushy_leading_hint_db`.`a`.`c3` AS `a_c3`,`bushy_leading_hint_db`.`b`.`d1` AS `d1`,`bushy_leading_hint_db`.`b`.`d2` AS `d2`,`bushy_leading_hint_db`.`b`.`d3` AS `d3`,`bushy_leading_hint_db`.`c`.`c1` AS `c_c1`,`bushy_leading_hint_db`.`c`.`c2` AS `c_c2`,`bushy_leading_hint_db`.`c`.`c3` AS `c_c3` from ((`bushy_leading_hint_db`.`nn1` `a` join `bushy_leading_hint_db`.`nn2` `b` on ((`bushy_leading_hint_db`.`a`.`c1` = `bushy_leading_hint_db`.`b`.`d2`))) join `bushy_leading_hint_db`.`nn1` `c` on ((`bushy_leading_hint_db`.`b`.`d1` = `bushy_leading_hint_db`.`c`.`c1`))) where (`bushy_leading_hint_db`.`a`.`c2` < 5) utf8mb4 utf8mb4_general_ci
v2 CREATE VIEW `v2` AS select /*+ LEADING(c (b a)) */`a`.`c1` AS `a_c1`,`a`.`c2` AS `a_c2`,`a`.`c3` AS `a_c3`,`b`.`d1` AS `d1`,`b`.`d2` AS `d2`,`b`.`d3` AS `d3`,`c`.`c1` AS `c_c1`,`c`.`c2` AS `c_c2`,`c`.`c3` AS `c_c3` from ((`bushy_leading_hint_db`.`nn1` `a` join `bushy_leading_hint_db`.`nn2` `b` on ((`a`.`c1` = `b`.`d2`))) join `bushy_leading_hint_db`.`nn1` `c` on ((`b`.`d1` = `c`.`c1`))) where (`a`.`c2` < 5) utf8mb4 utf8mb4_general_ci
create view v3 as select /*+ leading(c, (d, (a,b))) */ a.c1 as a_c1, a.c2 as a_c2, a.c3 as a_c3, b.d1, b.d2, b.d3, c.c1 as c_c1, c.c2 as c_c2, c.c3 as c_c3 from nn1 a join nn2 b
on a.c1 = b.d2
join nn1 c on b.d1 = c.c1 join nn1 d on d.c2 = c.c2 where a.c2 < 5 ;
v3 CREATE VIEW `v3` AS select /*+ LEADING(c (d (a b))) */`bushy_leading_hint_db`.`a`.`c1` AS `a_c1`,`bushy_leading_hint_db`.`a`.`c2` AS `a_c2`,`bushy_leading_hint_db`.`a`.`c3` AS `a_c3`,`bushy_leading_hint_db`.`b`.`d1` AS `d1`,`bushy_leading_hint_db`.`b`.`d2` AS `d2`,`bushy_leading_hint_db`.`b`.`d3` AS `d3`,`bushy_leading_hint_db`.`c`.`c1` AS `c_c1`,`bushy_leading_hint_db`.`c`.`c2` AS `c_c2`,`bushy_leading_hint_db`.`c`.`c3` AS `c_c3` from (((`bushy_leading_hint_db`.`nn1` `a` join `bushy_leading_hint_db`.`nn2` `b` on ((`bushy_leading_hint_db`.`a`.`c1` = `bushy_leading_hint_db`.`b`.`d2`))) join `bushy_leading_hint_db`.`nn1` `c` on ((`bushy_leading_hint_db`.`b`.`d1` = `bushy_leading_hint_db`.`c`.`c1`))) join `bushy_leading_hint_db`.`nn1` `d` on ((`bushy_leading_hint_db`.`d`.`c2` = `bushy_leading_hint_db`.`c`.`c2`))) where (`bushy_leading_hint_db`.`a`.`c2` < 5) utf8mb4 utf8mb4_general_ci
v3 CREATE VIEW `v3` AS select /*+ LEADING(c (d (a b))) */`a`.`c1` AS `a_c1`,`a`.`c2` AS `a_c2`,`a`.`c3` AS `a_c3`,`b`.`d1` AS `d1`,`b`.`d2` AS `d2`,`b`.`d3` AS `d3`,`c`.`c1` AS `c_c1`,`c`.`c2` AS `c_c2`,`c`.`c3` AS `c_c3` from (((`bushy_leading_hint_db`.`nn1` `a` join `bushy_leading_hint_db`.`nn2` `b` on ((`a`.`c1` = `b`.`d2`))) join `bushy_leading_hint_db`.`nn1` `c` on ((`b`.`d1` = `c`.`c1`))) join `bushy_leading_hint_db`.`nn1` `d` on ((`d`.`c2` = `c`.`c2`))) where (`a`.`c2` < 5) utf8mb4 utf8mb4_general_ci
v4 CREATE VIEW `v4` AS select /*+ LEADING(t2 (t1 t3) (t7 (t8 t9)) (t4 t5 t6)) */`bushy_leading_hint_db`.`t1`.`c1` AS `x`,`bushy_leading_hint_db`.`t3`.`c2` AS `y`,`bushy_leading_hint_db`.`t5`.`c2` AS `z` from `bushy_leading_hint_db`.`nn1` `t1`,`bushy_leading_hint_db`.`nn1` `t2`,`bushy_leading_hint_db`.`nn1` `t3`,`bushy_leading_hint_db`.`nn1` `t4`,`bushy_leading_hint_db`.`nn1` `t5`,`bushy_leading_hint_db`.`nn1` `t6`,`bushy_leading_hint_db`.`nn1` `t7`,`bushy_leading_hint_db`.`nn1` `t8`,`bushy_leading_hint_db`.`nn1` `t9` where (`bushy_leading_hint_db`.`t1`.`c1` = `bushy_leading_hint_db`.`t2`.`c1`) and (`bushy_leading_hint_db`.`t1`.`c1` = `bushy_leading_hint_db`.`t3`.`c2`) and (`bushy_leading_hint_db`.`t2`.`c1` = `bushy_leading_hint_db`.`t3`.`c1`) and (`bushy_leading_hint_db`.`t3`.`c1` = `bushy_leading_hint_db`.`t4`.`c1`) and (`bushy_leading_hint_db`.`t4`.`c1` = `bushy_leading_hint_db`.`t5`.`c1`) and (`bushy_leading_hint_db`.`t5`.`c1` = `bushy_leading_hint_db`.`t6`.`c1`) and (`bushy_leading_hint_db`.`t6`.`c1` = `bushy_leading_hint_db`.`t7`.`c1`) and (`bushy_leading_hint_db`.`t7`.`c1` = `bushy_leading_hint_db`.`t8`.`c1`) and (`bushy_leading_hint_db`.`t8`.`c1` = `bushy_leading_hint_db`.`t9`.`c1`) and (`bushy_leading_hint_db`.`t8`.`c1` = `bushy_leading_hint_db`.`t2`.`c1`) and (`bushy_leading_hint_db`.`t1`.`c1` = `bushy_leading_hint_db`.`t9`.`c1`) utf8mb4 utf8mb4_general_ci
v4 CREATE VIEW `v4` AS select /*+ LEADING(t2 (t1 t3) (t7 (t8 t9)) (t4 t5 t6)) */`t1`.`c1` AS `x`,`t3`.`c2` AS `y`,`t5`.`c2` AS `z` from `bushy_leading_hint_db`.`nn1` `t1`,`bushy_leading_hint_db`.`nn1` `t2`,`bushy_leading_hint_db`.`nn1` `t3`,`bushy_leading_hint_db`.`nn1` `t4`,`bushy_leading_hint_db`.`nn1` `t5`,`bushy_leading_hint_db`.`nn1` `t6`,`bushy_leading_hint_db`.`nn1` `t7`,`bushy_leading_hint_db`.`nn1` `t8`,`bushy_leading_hint_db`.`nn1` `t9` where (`t1`.`c1` = `t2`.`c1`) and (`t1`.`c1` = `t3`.`c2`) and (`t2`.`c1` = `t3`.`c1`) and (`t3`.`c1` = `t4`.`c1`) and (`t4`.`c1` = `t5`.`c1`) and (`t5`.`c1` = `t6`.`c1`) and (`t6`.`c1` = `t7`.`c1`) and (`t7`.`c1` = `t8`.`c1`) and (`t8`.`c1` = `t9`.`c1`) and (`t8`.`c1` = `t2`.`c1`) and (`t1`.`c1` = `t9`.`c1`) utf8mb4 utf8mb4_general_ci