从使用不同表空间的查询创建表 (Oracle SQL)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20620595/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 00:29:24  来源:igfitidea点击:

Creating a table from a query using a different tablespace (Oracle SQL)

sqloracletoad

提问by user1723699

I want to create some tables in our database from some queries I have developed. I used the code below and it created the table and it works great.

我想根据我开发的一些查询在我们的数据库中创建一些表。我使用了下面的代码,它创建了表格,效果很好。

The issue I am having is apparently it created the table using a different tablespace than the one we are supposed to use. Is there a way to specify that in code like what is below? Just a disclaimer, I am more of the end user of the data so I am not as tech savy.

我遇到的问题显然是它使用与我们应该使用的表空间不同的表空间创建了表。有没有办法在代码中指定它,如下所示?只是免责声明,我更像是数据的最终用户,所以我不太懂技术。

CREATE TABLE new_permanent_table
AS
SELECT *
FROM old_temporary_table
WHERE amount<5000;

回答by roartechs

Assuming that you have a quota on the other tablespace, you should be able to just add the "TABLESPACE <tablespace name>" statement below your CREATE TABLE statement:

假设您对另一个表空间有配额,您应该能够在 CREATE TABLE 语句下方添加“TABLESPACE <tablespace name>”语句:

CREATE TABLE new_permanent_table
TABLESPACE other_tablespace
AS
SELECT *
FROM old_temporary_table
WHERE amount<5000;