db2 中是否存在像 user_tables(在 oracle 中使用)这样的 table?
Does a table like user_tables (used in oracle) in db2 exist?
我知道 syscat.tables
存在于 db2 中。
我还尝试在 user_tables
中找到计数,并以这种方式获得输出:
db2 => select count(*) from user_tables
1
-----------
999
1 record(s) selected.
但我无法描述 table user_tables
而我可以描述任何其他 table.
示例:
db2 => describe table user_tables
Data type Column
Column name schema Data type name Length Scale Nulls
------------------------------- --------- ------------------- ---------- ----- ------
0 record(s) selected.
SQL0100W No row was found for FETCH, UPDATE or DELETE; or the result of a
query is an empty table. SQLSTATE=02000
你能帮我理解为什么会这样吗?
DB2 已创建 Oracle compatibility mode which needs to be enabled for a database. As part of this users can opt to have Oracle data dictionary-compatible views。其中一个观点是 user_tables
.
您可以尝试以下方法(未测试):
describe select * from user_tables
这应该 return 结果 table 的架构,即那个视图。
SELECT * 来自 systables WHERE SYSTEM_TABLE_SCHEMA ='YOURSCHEMA'
我知道 syscat.tables
存在于 db2 中。
我还尝试在 user_tables
中找到计数,并以这种方式获得输出:
db2 => select count(*) from user_tables
1
-----------
999
1 record(s) selected.
但我无法描述 table user_tables
而我可以描述任何其他 table.
示例:
db2 => describe table user_tables
Data type Column
Column name schema Data type name Length Scale Nulls
------------------------------- --------- ------------------- ---------- ----- ------
0 record(s) selected.
SQL0100W No row was found for FETCH, UPDATE or DELETE; or the result of a
query is an empty table. SQLSTATE=02000
你能帮我理解为什么会这样吗?
DB2 已创建 Oracle compatibility mode which needs to be enabled for a database. As part of this users can opt to have Oracle data dictionary-compatible views。其中一个观点是 user_tables
.
您可以尝试以下方法(未测试):
describe select * from user_tables
这应该 return 结果 table 的架构,即那个视图。
SELECT * 来自 systables WHERE SYSTEM_TABLE_SCHEMA ='YOURSCHEMA'