Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create Index-organized table with desc order

Could you please help me with creating IOT with three columns and one of them has to have desc order.

I've created the table, but it's not ordered by created_date desc.

My table:

create table audit_log (
     id integer,
     created_date timestamp,
     module_type_id integer,
     ...<other columns>...
     constraint pk_audit_log primary key (created_date, module_type_id, id)) 
organization index overflow;

I need IOT like constraint pk_audit_log primary key (created_date DESC, module_type_id, id)

Unfortunately, I couldn't find any resources on the web how to do it. Has anybody faced with any similar task or know how to create a script?

Thanks

like image 477
Viktor Avatar asked Dec 06 '25 18:12

Viktor


1 Answers

I don't think this is possible. A descending index is actually function-based index using Oracle internal function SYS_OP_DESCEND. And a primary index of an index organized table cannot be function-based.

like image 80
Husqvik Avatar answered Dec 08 '25 10:12

Husqvik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!