Microsoft SQL 和 ORACLE 中存在的 Sql In-Memory 对象
是否存在任何内存中对象(例如 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的。 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.
Oracle 有临时表,但您必须在安装时创建它们:
Oracle has temporary tables but you have to creat them at installation time:
CREATE TEMPORARY TABLE
to create the table