Oracle create table using with clause

后端 未结 3 773
不知归路
不知归路 2021-02-01 03:32

Can I create a table from a query formed using with clause?

3条回答
  •  孤独总比滥情好
    2021-02-01 04:06

    The CREATE TABLE table_name AS statement creates a table based on a select statement. The solution for a with clause will be :

    CREATE TABLE t
    AS 
    SELECT * FROM (
    WITH some_data AS ( 
       SELECT 1 as some_value 
       FROM dual
    
       UNION ALL 
    
       SELECT 2 
       FROM dual
    ) 
    );
    

提交回复
热议问题