将 360,000 行导入全局临时文件 Table

Importing 360,000 rows into a Global Temporary Table

我在将数字列表导入我创建的全局临时 Table 时遇到一些问题。

问题:将数据导入全局临时文件时Table,即使有成功消息提示,也不会在所需列中显示任何内容。

先前的努力:

我目前正在使用数据导入向导方法来执行此操作。我尝试从 .txt 导入,但它给了我一个空错误。我尝试从 .xlsx 导入,但它给了我 Java 堆 space 错误。我尝试将我的 .txt 文件重命名为 .tsv 文件,它说它有效,但没有导入实际数据。下图显示完成,但所需列中的最终结果计数仍为 0。


我之前尝试使用 SQL Developer 在工作表中执行插入语句,但是,我一次只能将大约 20,000 行插入语句复制并粘贴到工作表中。我不想多次复制和粘贴。但是,这样做会更新 table 并保留数据。

问题现已得到解答。见下文。

默认情况下,全局临时 table 是使用隐式 on commit delete 子句创建的:

create global temporary table tblbc (bc number);

Global temporary TABLE created.

select duration from user_tables where table_name = 'TBLBC';

DURATION      
---------------
SYS$TRANSACTION

导入正在提交,如对话消息所述。这意味着数据随后会从 GTT 中删除,因为这是设置的持续时间。这相当于做:

insert into tblbc(bc) values (42);

1 row inserted.

commit;

Commit complete.

select * from tblbc;

no rows selected

如果您重新定义 GTT,那么您将能够在提交后看到导入的数据,至少在同一会话中:

drop table tblbc;

Table TBLBC dropped.

create global temporary table tblbc (bc number) on commit preserve rows;

Global temporary TABLE created.

select duration from user_tables where table_name = 'TBLBC';

DURATION      
---------------
SYS$SESSION    

insert into tblbc(bc) values (42);

1 row inserted.

commit;

Commit complete.

select * from tblbc;

        BC
----------
        42

您现在可以将 GTT 中的数据与其他 table 中的数据进行比较,同样是在该会话中。结束会话后,GTT 数据将会丢失。