January 2012
Intermediate to advanced
542 pages
11h 28m
English
In this recipe, we will introduce reverse key indexes. We will look at when to use them and how they are related to performance.
The following steps will demonstrate reverse keys:
CONNECT sh@TESTDB/sh
CREATE TABLE REVERSE_TEST ( ID NUMBER NOT NULL, NAME VARCHAR(100) );
CREATE SEQUENCE REV_SEQ START WITH 1 INCREMENT BY 1 CACHE 1000;
CREATE OR REPLACE TRIGGER TR_REVERSE_TEST_INS BEFORE INSERT ON REVERSE_TEST FOR EACH ROW WHEN (NEW.ID IS NULL) BEGIN SELECT REV_SEQ.NEXTVAL INTO :NEW.ID FROM DUAL; END;
UNIQUE INDEX on ID:
CREATE UNIQUE ...Read now
Unlock full access