kinkajou
kinkajou

Reputation: 99

Oracle problem creating index organized table using "create as" statement

So I'm trying to create a copy of one of my tables into an index organized table, However I get an error, here is the code.

create table clients2 as
select *
from clients
organization index;

ORA-00933:"SQL command not properly ended"

Upvotes: 1

Views: 201

Answers (1)

Roberto Hernandez
Roberto Hernandez

Reputation: 8518

Your command is wrong.

SQL> create table testiot ( object_id primary key,object_name ) 
     organization index 
     as select object_id,object_name from dba_objects 
     where object_id is not null ;

Table created.

SQL> select count(*) from testiot ;

  COUNT(*)
----------
    208730

Organization index must be in the definition of the table and before as select. On the other hand, you need to define the columns in the table and which one is the primary key for IOT.

Upvotes: 4

Related Questions