 |
|
EnterpriseDB: Create Table As (CTAS) Wizard
Oracle Tips by
Burleson
|
The
create table
as,
also known as CTAS, wizard (Figure 5.25)
allows
you to create tables from existing tables via a query. The tables
created maintain any column level constraints but do not inherit any
table level constraints. This is because you can combine multiple
tables in a single statement.
Figure
5.25: Create Table As Query Wizard
The
table name and query are both required parameters. You may load the
query with a SQL statement from a file by clicking the Import From
File button. You may also save the query to file by using the Export
To File button.
You may
use any valid SQL statement, including joins, in the SQL query.
You may
also include an optional list of column names. I find it easiest to
allow the query to define the column names.
Create View Wizard
A view
is a stored query. The create view wizard (Figure 5.26) looks much
like the CTAS wizard. Instead of instantiating a table with data, the
query is stored and is instantiated at run time.
Figure
5.26: Create View Wizard
The view
name and query are both required parameters. You may load the query
with a SQL statement from a file by clicking the Import From File
button. You may also save the query to file by using the Export To
File button.
You may
use any valid SQL statement, including joins, in the SQL query.
Create Packages/Procedures/Functions/Triggers
The
wizard to create stored code is actually the SQL Interactive window
with a code template pre-loaded. I will cover coding below in the
section on SQL & SPL development.
Create Sequence Wizard
A
sequence is an incremental number generator. The create sequence
wizard (Figure 5.27) creates a sequence.
Figure
5.27: Create Sequence Wizard
The only
mandatory parameter when creating a sequence is the sequence name,
which must follow object naming standards.
The
optional (defaulted) parameters are:
* You
can choose whether the number will be incremented (+) or decremented
(-).
*
Increment – The increment is the number that will be added to or
subtracted from during each call to nextval.
*
MinValue – The MinValue is the lowest a decrement sequence will go
before giving an error or cycling (if cycle is selected)
*
MaxValue – The MaxValue is the highest an increment sequence will go
before giving an error or cycling (if cycle is selected)
* Start
– The number to start with on the next call to nextval
* Cache
– The number to cache in memory for each session. Useful for
improving performance
* Cycle
– Should this sequence start over upon hitting the MinValue or
MaxValue (depending in increment or decrement)?
This
is an excerpt from the book "EnterpriseDB:
The Definitive Reference" by Rampant TechPress. |