Example of Cluster Index:
The following instance creates the cluster along with tables.
CREATE CLUSTER CLEMP(deptno NUMBER(3));
Create index clind on cluster clemp;
Create table dept (deptno number(3),dname varchar2(20),loc varchar2(20)) cluster clemp(deptno);# for creating index on cluster#
Create table emp(empno number,ename varchar2(20),deptno number(3)) cluster clemp(deptno); # for creating index on cluster#
A rowid of the first deptno will be the same when records are selected,.
Output:
SELECT ROWID FROM CLUSTER clemp;
ROWID
------------------
AAAAzmAAFAAAAJ+AAA
AAAAzmAAFAAAAJ/AAA
AAAAzmAAFAAAAKAAAA
AAAAzmAAFAAAAKBAAA
AAAAzmAAGAAAAIAAAA
Dropping Clusters
A Cluster are dropped by using DROP CLUSTER command.
Example:
DROP CLUSTER CLEMP INCLUDING TABLES;