【问题标题】:How to create temp tables + unions in Oracle如何在 Oracle 中创建临时表 + 联合
【发布时间】:2014-11-23 21:43:54
【问题描述】:

这在 Mssql 中运行良好。

如何在 Oracle 中重写:

create table #temptable (mgr bigint)
insert into #temptable (mgr)  ( 
select 1 
union select 2
union select 3)

【问题讨论】:

  • 您想达到什么目标?您是否知道临时表中的数据仅保留到会话结束或是否存在提交/回滚(取决于临时表的类型)?

标签: sql-server oracle oracle11g oracle10g


【解决方案1】:

你可以像这样创建一个临时表:

create global temporary table temptable (mgr number);

将数据插入此表:

insert into temptable
select 1 from dual union all
select 2 from dual union all
select 3 from dual; 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-12-07
    • 2011-02-09
    • 2015-12-12
    • 2018-12-18
    • 1970-01-01
    • 1970-01-01
    • 2016-04-02
    相关资源
    最近更新 更多