Can I create a table from a query formed using with
clause?
In Oracle, CREATE TABLE statement is used to create a new table in the database. To create a table, you have to name that table and define its columns and datatype for each column. Syntax: CREATE TABLE table_name.
DEFAULT clause of CREATE TABLEUse the DEFAULT clause in the CREATE TABLE statement to specify the default value for the database server to insert into a column when no explicit value for the column is specified.
The WITH clause, or subquery factoring clause, is part of the SQL-99 standard and was added into the Oracle SQL syntax in Oracle 9.2. The WITH clause may be processed as an inline view or resolved as a temporary table.
Sure:
CREATE TABLE t AS WITH some_data AS ( SELECT 1 as some_value FROM dual UNION ALL SELECT 2 FROM dual ) SELECT * FROM some_data
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With