oracle 检查临时表是否存在
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8156784/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Check to see if a Temporary Table exists
提问by Stealth Rabbi
How do I check to see if an Oracle temporary table exists? I do not see the table when querying ALL_TABLES or USER_TABLES when I know it exists.
如何检查 Oracle 临时表是否存在?当我知道它存在时,在查询 ALL_TABLES 或 USER_TABLES 时我没有看到该表。
Also, to make sure I understand temporary tables, if created with ON COMMIT DELETE ROWS, the table will always exist, but the data will be deleted when the session ends? Is a session referring to when a connection is closed?
另外,为了确保我理解临时表,如果使用 ON COMMIT DELETE ROWS 创建,该表将始终存在,但会话结束时数据将被删除?会话是指连接关闭的时间吗?
回答by Justin Cave
A temporary table will be listed in USER_TABLES
if you own it and in ALL_TABLES
if you have privileges on the table. It will be listed in DBA_TABLES
if it exists in the database but you may not have privileges to query DBA_TABLES
. If the table exists in the database but it is not in ALL_TABLES
, that implies that the current user does not have privileges on the temporary table.
USER_TABLES
如果您拥有临时表,并且ALL_TABLES
您对该表具有特权,则将列出该临时表。DBA_TABLES
如果它存在于数据库中,它将被列出,但您可能没有查询权限DBA_TABLES
。如果该表存在于数据库中但不在 中ALL_TABLES
,则表示当前用户对临时表没有权限。
Yes, a temporary table will always exist (once it is created, of course). When you specify ON COMMIT DELETE ROWS
, the data in the temporary table will be removed when the transaction completes (either committing or rolling back). Each session will always only see the data that it has inserted into the table but when you specify ON COMMIT DELETE ROWS
you're further limiting the time that the data exists to the current transaction.
是的,临时表将始终存在(当然,一旦创建)。当您指定时ON COMMIT DELETE ROWS
,临时表中的数据将在事务完成(提交或回滚)时删除。每个会话将始终只看到它插入到表中的数据,但是当您指定时,ON COMMIT DELETE ROWS
您将进一步限制数据存在于当前事务的时间。