Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 Oracle PL/SQL: TABLE - Using Select Statement With Data Jump to:  
Category: >> Oracle PL/SQL >> TABLE - Using Select Statement With Data Bookmark and Share

<< lastnext >>

Snippet Name: TABLE - Using Select Statement With Data

Description: Create Table Using a Select statement

CREATE TABLE AS creates a table from the result of a SELECT statement. All of the expressions that can be used in a SELECT statement can be used in a CREATE TABLE AS statement. You can also include all of the data from the table or tables that you are selecting from.

Also see:
» Get and set select lists with Javascri...
» Selecting a Random Row
» TABLESPACE: Show contiguous space
» TABLESPACE: SYSAUX tablespace
» TABLESPACE: Tablespace management
» TABLESPACE: List tablespaces, files, ...
» TABLESPACE: Dropping Tablespaces
» TABLESPACE: Alter Permanent Tablespace
» TABLESPACE: Transportable tablespaces
» TABLESPACE: Tempfile operations
» TABLESPACE: Create temp tablespace
» TABLESPACE: Change UNDO tablespace
» TABLESPACE: Undo Tablespace
» TABLESPACE: SYSAUX Tablespace
» TABLESPACE: Set default tablespace type
» TABLESPACE: Oracle Managed Auto-extend...
» TABLESPACE: Permanent Tablespace Using...
» TABLE - Constraints
» TABLE - Options
» TABLE - Using Select Statement With D...
» TABLE - Multiple Columns
» TABLE - queries
» TABLE - simple heap table
» TABLESPACE: Using Raw Devices
» TABLESPACE: permanent tablespace
» SELECT: Case insensitive search
» SELECT: Partition Select
» SELECT: Select For Update
» SELECT: Using Functions
» SELECT: Get DISTINCT / UNIQUE values

Comment: (none)

Language: PL/SQL
Highlight Mode: PLSQL
Last Modified: March 11th, 2009

WITH data
 
CREATE TABLE  test3 AS
SELECT table_name, tablespace_name
FROM all_tables;
 
---------------------------------
 
without data
 
CREATE TABLE  ctas AS
SELECT table_name, tablespace_name
FROM all_tables
WHERE 1=2;
 
 
-- For example, create a table named EMPLOYEE3 that includes all 
-- of the column definitions from EMPLOYEE where the DEPTNO = D11.
 
CREATE TABLE EMPLOYEE3 AS
   (SELECT PROJNO, PROJNAME, DEPTNO
    FROM EMPLOYEE
    WHERE DEPTNO = 'D11') WITH NO DATA
 


Free
Oracle Magazine
Subscriptions
and Oracle White Papers


SQL University.net courses meet the most demanding needs of the business world for advanced education in a cost-effective manner. SQL University.net courses are available immediately for IT professionals and can be taken without disruption of your workplace schedule or processes.

Compared to traditional travel-based training, SQL University.net saves time and valuable corporate resources, allowing companies to do more with less. That's our mission, and that's what we deliver.

Click here to find out more
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 69 users online    © 2009 psoug.org

PSOUG LOGIN
Username: 
Password: 
Forgot your password?