Index Creation For Mutli Value Fields
Index Creation For Mutli Value Fields
database.
Step-1:
,extractValue(a.XMLRECORD,'/row/c3[position()=1]') "NAME_1"
,extract(a.XMLRECORD,'/row/c3') "NAME_1_3"
3 as rtnval varchar2(100);
4 begin
6 return rtnval;
7 end;
8 /
Function created.
Step-2:
Alter the table for the column "NAME_1" using below command
Table altered.
Step-3:
Create index for the altered field as below in order to make use of index when column is
passed with a normal value.
Note: When there is a possibility to have null value for the column then the index should be
created with constant "1"
SQL> CREATE INDEX IX_NAME_CUSTOMER ON FBNK_CUSTOMER(NAME_1,'1');
Index created.
Step-4:
Execute the below command in sqlplus in order to get the data definition language for the
problematic field. "TAFJR14" denotes the currently logged in database user name.
Post creating the index if we perform a SS rebuild the new column will be taken into
consideration in the view definition.
,extract(a.XMLRECORD,'/row/c2') "SHORT_NAME_2"
,NAME_1 "NAME_1"
,extract(a.XMLRECORD,'/row/c3') "NAME_1_3"
,extractValue(a.XMLRECORD,'/row/c4[position()=1]') "NAME_2"
,extract(a.XMLRECORD,'/row/c4') "NAME_2_4"
,extractValue(a.XMLRECORD,'/row/c5[position()=1]') "STREET"
,extract(a.XMLRECORD,'/row/c5') "STREET_5"
,extractValue(a.XMLRECORD,'/row/c6[position()=1]') "ADDRESS"
,extract(a.XMLRECORD,'/row/c6') "ADDRESS_6"
,extractValue(a.XMLRECORD,'/row/c7[position()=1]') "TOWN_COUNTRY"
Step-5:
Execute the explain plan and check whether the SELECT command is making use of index or
not
SQL> EXPLAIN PLAN SET statement_id = 'ex_plan100' FOR SELECT RECID FROM
"V_FBNK_CUSTOMER" WHERE "NAME_1" ='OJASVI';
Explained.
Step-6:
PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------
-------------
----------------------------------------------------------------------------------------------------------------
-------------
--------------------------------------------------
---------------------------------------------------
---------------------------------------------------
---------------------------------------------------
11 rows selected.