find () or search () function
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: find () or search () function

  1. #1
    Join Date
    May 2002
    Location
    USA
    Posts
    462

    find () or search () function

    Hi ,

    has any body come across a oracle function or user defined function , which can retrieve following data .

    eg : a particular column in my table contains following data

    colA
    ------
    abcdef
    adfavs
    cdefab
    fecdab
    adfbce

    looking for the following out put after searching 'cde' values .
    eg : something like find(colA , 'cde' )

    abcdef
    fecdab
    cdefab
    adfbce

    any suggestions or script will be highly appreciated .
    siva prakash
    DBA

  2. #2
    Join Date
    Sep 2001
    Location
    Düsseldorf, Germany.
    Posts
    588
    Is this what you are expecting?

    Code:
    SQL> insert into delme values ('abcdef'); 
    
    1 row created.
    
    SQL> insert into delme values ('adfavs');
    
    1 row created.
    
    SQL> insert into delme values ('cdefab');
    
    1 row created.
    
    SQL> insert into delme values ('fecdab');
    
    1 row created.
    
    SQL> insert into delme values ('adfbce');
    
    1 row created.
    
    SQL> 
    SQL> select * from delme where instr(name,'cde') > 0;
    
    NAME
    ---------------------------------------------------------
    cdefab
    abcdef
    
    SQL> 
    
    This contains "cde"
    
    
    SQL> select * from delme where ( instr(name,'c') > 0 
      2  and instr(name,'d') > 0 and instr(name,'e') > 0 ); 
    
    NAME
    ---------------------------------------------------------
    cdefab
    fecdab
    adfbce
    abcdef
    
    SQL> 
    
    This contains "c" and "d" and "e"
    Sameer

  3. #3
    Join Date
    Jun 2000
    Location
    Madrid, Spain
    Posts
    7,447
    use like???

  4. #4
    Join Date
    May 2002
    Location
    USA
    Posts
    462
    thanks sameer ,
    i was looking for this
    now i can extend this to search words in a column and make a find()function . which could dynamically access any number of arguments to search in a single column .
    siva prakash
    DBA

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width