Search code examples
oracle-databasesubstr

Extracting 8 words from oracle text field


I am facing some issue in extraction 8 words from oracle text field.There is no issue in extracting 10 words from start of string but i want to extract 10 words after this "(" character.My Query is given below.

select substr(title,instr(title,'(',1),1,10) from tablename;

sample data is given below
160722-N-QI061-651 ARABIAN GULF (July 22, 2016) An F/A-18E Super Hornet assigned to the Sidewinders of Strike Fighter Squadron (VFA)


Solution

  • I resolve my issue using below mentioned method/queries

    update tablename set title2=replace(substr(title,1,instr(title,' ',1,20)),substr(title,1,instr(title,')',1)),'')
    update tablename set title2='999 '||' '||title2;
    select replace(substr(title2,1,instr(title2,' ',1,11)),'999','') from tablename;