Microsoft SQL 和 ORACLE 中存在的 Sql In-Memory 对象

发布于 2025-01-06 01:12:00 字数 309 浏览 3 评论 0原文

是否存在任何内存中对象(例如 Microsoft SQL Server 临时表)也可用于 Oracle?

更新

我询问临时表,因为我必须复制 X 数据集并将它们再次插入到同一个表中,并对复制的数据集的字段进行一些更新。仅复制操作就会导致主约束异常,因此我必须执行 Insert Into(Select... 到内存中对象中,在那里进行更新,然后将所有更改数据集写回到原始表中。什么是更适合的临时表或表变量?考虑我使用 ADO.NET,因此由于语言差异,执行的一条语句必须适用于 Oracle 和 MS Sql Server,没有例外。

Does there exist any In-Memory object like the Microsoft SQL Server Temporary tables that can be used for Oracle too?

UPDATE:

I asked about Temp tables because I have to copy X dataset and Insert them again in the same table And do some updates on the fields of the copied dataset. The copy action alone would cause a primary constraint exception, therefore I have to do a Insert Into(Select... into an In-Memory object, do updates there and then write back all changes dataset into the original table. What is better suited Temp Table or Table variable? Consider I use ADO.NET. So ONE statement which is executed must work for Oracle AND MS Sql Server without exception due to language differences.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

逆光飞翔i 2025-01-13 01:12:00

是的。 Oracle 也有临时表。或者您可能在询问表变量 (很难从你的问题中看出)?他们的回答也是

仅供参考:SQL 中的临时表不能保证“在内存中”

更新:回答您添加到 OP 中的新问题。
使用最适合您的代码的内容。我认为无论您使用表变量还是“真正的”临时表,这都没有实质性的不同。更好的问题是使用全局临时表还是本地临时表。在这种情况下,我会说避免使用全局变量,除非你别无选择。

Yes. Oracle has temporary tables too. Or perhaps you were asking about Table variables (hard to tell from your question)? They answer to that is also yes.

FYI: Temporary tables in SQL aren't guaranteed to be "in memory"

Update: To answer the new question you added to the OP.
Use whatever works best for your code. I don't think it makes a substantial different whether you use table varaibles or "real" temporary tables. A better question is whether to use global or local temporary tables. In that case, I'd say avoid the globals unless you don't have a choice.

尘曦 2025-01-13 01:12:00

Oracle 有临时表,但您必须在安装时创建它们:

  1. 安装数据库时使用 CREATE TEMPORARY TABLE 来创建表
  2. 每个用户只能看到自己的数据,并且当他们安装时这些数据会丢失结束他们的会话或提交他们的事务,以便您可以用于临时处理。

Oracle has temporary tables but you have to creat them at installation time:

  1. when installing your DB use CREATE TEMPORARY TABLE to create the table
  2. Each user can only see their own data, and this data is lost when then they end their session or commit their transaction so you can use for temporary processing.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文