Oracle中的临时表与全局临时表有什么区别? [英] What is the difference between a temporary table vs global temporary table in Oracle?

查看:335
本文介绍了Oracle中的临时表与全局临时表有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我听说过这两个术语临时表和全局临时表在类似的上下文中使用。

I have heard these two terms "temporary table" and "global temporary table" used pretty much in similar context.

两者之间有什么区别? / p>

What is the difference between the two?

推荐答案

在Oracle中没有任何区别。在Oracle数据库中创建临时表时,它将自动为全局,并且需要包括全局关键字。

In Oracle there isn't any difference. When you create a temporary table in an Oracle database, it is automatically global, and you are required to include the "Global" key word.

定义如何解释术语GLOBAL TEMPORARY TABLE的SQL标准允许LOCAL或GLOBAL作用域。这将允许用户特定表(LOCAL)或大家(GLOBAL)。 Oracle仅实现GLOBAL版本。

The SQL standard, which defines how the term "GLOBAL TEMPORARY TABLE" is interpreted, allows for either a LOCAL or GLOBAL scope. This would allow for either a user specific table (LOCAL) or everyone (GLOBAL). Oracle implements only the GLOBAL version.

您放入Oracle临时表的数据特定于您的会话。也就是说,即使有100个用户都使用相同的表,只有您可以看到您的数据,并且当您断开连接时(或提交当前事务时),您的数据将从表中删除,具体取决于表设置。

The data you put into an Oracle Temporary table is specific to your session. That is, only you can see your data even if there are 100 users all using the same table, and your data is deleted from the table when you disconnect (or when you commit the current transaction) depending upon table settings.

与MS SQL-Server对比,其中临时表是本地的。如果创建一个,除了你以外没有人知道你的临时表存在。在Oracle中,创建临时表允许每个人(有权访问您的模式的所有人)看到该表。当您注销会话时,SQL-Server表将被删除,并且将需要为下一个会话重新创建。在Oracle中,临时表现在是模式的永久部分,即使数据不是。

Contrast this with MS SQL-Server, where temporary tables are local. If you create one, no one besides you knows that your temporary table exists. In Oracle, creating the temporary table allows everyone (well everyone with access to your schema) to see the table. When you log out of your session, the SQL-Server table is deleted and will need to be recreated for the next session. In Oracle, the temporary table is now a permanent part of your schema, even if the data isn't.

这篇关于Oracle中的临时表与全局临时表有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆