【发布时间】:2017-12-26 12:49:29
【问题描述】:
我想使用 ANSI SQL 创建一个临时表,以便可以使用相同的查询在 ORACLE 和 MSSQL 中创建表。
【问题讨论】:
-
你不能。创建临时表没有标准。这是特定于供应商的。
-
临时表包含在 ANSI SQL(功能 F531)中,但大多数产品都以自己的方式执行...
我想使用 ANSI SQL 创建一个临时表,以便可以使用相同的查询在 ORACLE 和 MSSQL 中创建表。
【问题讨论】:
Create temporary table using the following statement
CREATE GLOBAL TEMPORARY TABLE my_temp_table (
id NUMBER,
description VARCHAR2(20)
)
ON COMMIT PRESERVE ROWS;
ON COMMIT PRESERVE ROWS clause indicates that rows should persist beyond the end of the transaction. They will only be removed at the end of the session.
【讨论】: