Here is a simple example of how you can create a table in Oracle using the storage clause. The following is the syntax of Create Table
command in Oracle using the Storage
clause:
Syntax
Create Table (column1 data_type, column2 data_type) [tablespace table_space_name] storage (Initial 1m Next 1m Maxextents Unlimited) /
Create Table Storage Clause Example
In the below example, it will create a table named emp_table
with tablespace
my_table_space
. The initial size will be allotted 5mb, and every time it will increase with 5mb extent.
Create Table emp_table ( empno Number, ename Varchar2(100), sal Number, photo Blob ) Tablespace my_table_space Storage ( Initial 5m Next 5m Maxextents Unlimited ) /
The tablespace
clause is optional, so if you will exclude it, the default tablespace
will be allotted.
Similarly, you can create a table as a copy of another table. The following is an example:
Create Table big_data Storage ( Initial 50m Next 50m Maxextents Unlimited ) As Select * From another_big_data /
In the above example, I excluded the tablespace
clause so it will use the default tablespace
. And the initial size of the table would be 50mb, and it will increase by 50mb. You can specify large sizes if you know that your table is going to store massive data.
Leave a comment