CLOB searching

I have a column which is a CLOB. The data in this column is Huge and the Number of Records are also more.(In Millions)
I want to have a search condition on this CLOB Column.
Can I go for Indexing of this column or is there any better way of going for a search criterial on this CLOB Column.

You would probably be served using Oracle Text rather than storing data in CLOBs. Oracle Text acts like a search engine for text, parsing it into tokens that are then indexed.
The Oracle Text Reference and the Oracle Text Application Developer's Guide would be good places to start learning about this technology
http://www.oracle.com/pls/db102/portal.portal_db?selected=7
Justin

Similar Messages

  • Clob searching user_views

    Hi,
    I needed to search for some specific text in the DDL of each of views in a particular schema.  The text column of the user_views is LONG, and I looked at some old Tom's threads for converting long2clob, but found these processes to be really cumbersome, so I just opted to use DBMS_METADATA.GET_DDL instead even if it is a little slow.
    One area I do not have a lot of experience with is searching clob fields.  I tried this but not sure what would be the appropriate function to use for something like this:
    SELECT *
    FROM
        SELECT
            object_name,
            object_type,
            DBMS_METADATA.GET_DDL(
                object_type => 'VIEW',
                NAME => object_name,
                SCHEMA => 'SCHEMA123'
            ) object_text
        FROM all_objects
        WHERE object_type = 'VIEW'
        AND owner = 'SCHEMA123'
    WHERE contains(object_text, 'WHERE t.policy NOT LIKE') > 0; -- Show the names of all views that contain the matching text

    Do you want something like the following:
    SQL> show long
    long 80
    SQL> select text from user_views where view_name='ALL_ALL_TABLES';
    TEXT
    select OWNER, TABLE_NAME, TABLESPACE_NAME, CLUSTER_NAME, IOT_NAME, STATUS,Then set a higher output limit...
    SQL> set long 1000
    SQL> /
    TEXT
    select OWNER, TABLE_NAME, TABLESPACE_NAME, CLUSTER_NAME, IOT_NAME, STATUS,
         PCT_FREE, PCT_USED,
         INI_TRANS, MAX_TRANS,
         INITIAL_EXTENT, NEXT_EXTENT,
         MIN_EXTENTS, MAX_EXTENTS, PCT_INCREASE,
    ...Edit: Sorry Satish, I type and copy and paste too slow :)
    Message was edited by:
    orafad

  • Optimizing CLOB search

    If I Query on date & on a location, it will limit the search but not gain any performance enhancements. I'm looking for details on the Optimizer Process for Text Search.
    With three types of Basic Text Search: Context, Catalog and Classification, which type should we base the search on if we store the data as a CLOB with 5 columns?

    With the minimal information that you have provided , I would suggest you to have a look at the Catalog Type . As this is the best suited for Queries which are combination of a text component (CLOB data ) and a structured component ( Normal Columns )

  • Not able to display and search on CLOB attribute in default search screen

    Hi,
    My requirement:
    I have three VARCHAR attributes and 1 CLOB attribute. i need to search the values on these 4 attributes.
    Created View crieteria on these 4 attributes and created default ADF search screen. but not able to add the CLOB attribute as search attribute.
    is there any solution for this or we can't search on CLOB attribute.
    FYI: i have created Converter using ClobDomain and and using this converted for editing the CLOB data.
    If i try adding the CLOB attribute in view criteria with ClobDomain and not able to see that attribute on search panel.
    Please help on this.
    Thanks in advance!!
    Thanks & Reagrds,
    Madhu

    Madhu, please tell us your jdev version!
    The search is done on the DB (query) so the converter is not used. To search clob columns you can use special SQL statements called contains or catsearch. These are using special index to find the data in blob or clob columns.
    Check my blog on how to integrate this into VC: http://tompeez.wordpress.com/2011/08/21/extending-viewcriteria-to-use-sql-contains-4/
    Timo

  • Storing and searching XML in CLOBs

    Speaking to an oracle employee at the Oracle booth at JavaOne
    recently. They suggested I store XML in CLOBs
    and use the DOM or SAX to reparse the XML later as needed.
    I agreed that this was the best solution for my problem
    (which was how to manage many different XML documents using many
    different DTDs in a document management system)
    The big problem was searching this document repository
    to locate relevant information.
    This is where Intermedia seemed ideal (still does).
    It would be nice to see an example of setting this up using
    Intermedia in Oracle 8i, demonstrating how to define the
    XML_SECTION_GROUP and where to use a ZONE as opposed to a FIELD
    etc.
    Anybody care to take a shot at this ????
    For example:
    How would I define Intermedia parameters
    so that I would be able to search my CLOB
    column for records that had the <keyword>
    "aorta" and "damage" in the <caption>
    using the following
    XML (DTD implied)
    <image filename="OurImageName.gif">
    <fname>WellKnownFileName.gif</fname>
    <keyword>echocardiogram</keyword>
    <keyword>aorta</keyword>
    <caption>This is an image of the vessel damage</caption>
    </image>
    Thanks
    Thomas Bennett
    null

    Eric (guest) wrote:
    : You can't do XML structure-based searches with intermedia. You
    : can search for text within a given element, but nothing more
    : complicated than that.
    The example he gave involves exactly that -- searching for
    text within XML elements. interMedia can do this.
    : It also does not do attributes.
    Upcoming 8.1.6 version allows searching within
    attribute text. That's something like:
    dog within book@author
    We're working on attribute value sensitive search,
    more like:
    dog within book[@author = "Eric"]
    : Thomas Bennett (guest) wrote:
    : : How would I define Intermedia parameters
    : : so that I would be able to search my CLOB
    : : column for records that had the <keyword>
    : : "aorta" and "damage" in the <caption>
    : : using the following
    : : XML (DTD implied)
    : : <image filename="OurImageName.gif">
    : : <fname>WellKnownFileName.gif</fname>
    : : <keyword>echocardiogram</keyword>
    : : <keyword>aorta</keyword>
    : : <caption>This is an image of the vessel damage</caption>
    : : </image>
    begin
    ctx_ddl.create_section_group('mygrp','basic_section_group');
    ctx_ddl.add_field_section('mygrp','keyword','keyword');
    ctx_ddl.add_field_section('mygrp','caption','caption');
    end;
    create index myidx on mytab(mytxtcolumn)
    indextype is ctxsys.context
    parameters ('section group mygrp');
    select * from mytab
    where contains(mytxtcolumn, 'aorta within keyword')>0;
    options:
    * use XML section group instead of basic section group
    if your tags have attributes or you need case-sensitive
    tag detection
    * use zone sections instead of field sections if your
    sections overlap, or if you need to distinguish
    between instances. For instance, keywords. If keywords
    is a field section, then
    (aorta and echocardiogram) within keywords
    finds the document. if it is a zone section, then it
    doesn't, because they are not in the SAME instance of
    keywords.
    null

  • Case Insenstive Search using CLOB

    Can you do case insenstive search in CLOB, using DBMS_LOB.instr
    or any other way or is it necessary to install inter media for
    that??

    http://asktom.oracle.com/pls/ask/f?p=4950:8:16408444532599416076::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:440419921146,

  • Intermedia text search in XML document stored as CLOB

    Suppose i store an XML document as clob
    and i index it based on the tags ie
    if i have the followind table
    create table biodata (
    resume_id number primary key,
    content clob default empty_clob(),
    applicant_id number references
    applicants(id));
    and i stores various resumes in the clob (content column ) as xml document ie
    <experience_in_months> 22 </experience_in_months>
    Now if i want all the resume_id that that have experiences_in_months >= 10
    what would be the query that would fetch me this result?

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by voron:
    We are storing data in XML format in an Oracle database (via CLOB). I can retrieve search results using the 'within' phrase, but am finding it hard to order them. Is there a utility or command I can use?<HR></BLOCKQUOTE>
    Maybe you should write a stored procedure (function )
    that extracts the section from your clob
    that should be sorted. Then use this function
    in the ORDER clause of your select statement.
    Andreas
    null

  • How to search for CLOB item in Form?

    I create a table
    CREATE TABLE PHOTOS
    (PHOTO_ID VARCHAR2(15) NOT NULL,
    PHOTO_IMAGE BLOB,
    TEXT_DESCRIPTION CLOB,
    FILENAME VARCHAR2(50),
    FILE_SIZE NUMBER NOT NULL,
    ACCESS_RIGHT VARCHAR2(7) NOT NULL,
    CONSTRAINT CK_ACCESS_RIGHT CHECK (ACCESS_RIGHT IN ('PRIVATE', 'PUBLIC')),
    CONSTRAINT PK_PHOTOS PRIMARY KEY (PHOTO_ID)
    create index idx_photos_text_desc on
    PHOTOS(TEXT_DESCRIPTION) indextype is ctxsys.context;
    INSERT INTO PHOTOS VALUES
    ('P00000000000001', empty_blob(), empty_clob(),
    'SCGP1.JPG',100,'PUBLIC');
    INSERT INTO PHOTOS VALUES
    ('P00000000000002', empty_blob(), 'Cold Play with me at the concert in Melbourne 2005',
    'COLDPLAY1.JPG',200,'PUBLIC');
    INSERT INTO PHOTOS VALUES
    ('P00000000000003', empty_blob(), 'My parents in Melbourne 2001',
    'COLDPLAY1.JPG',200,'PRIVATE');
    COMMIT;
    EXEC CTX_DDL.SYNC_INDEX('idx_photos_text_desc');
    I created a Form which maintains the above table. I found that the Query By Example does not work for TEXT_DESCRIPTION which is CLOB.
    How can I search text in CLOC using Forms?
    Message was edited by:
    wyfwong

    What version of forms? There is a Forms/CLOB bug that gets fixed in 10g Forms.
    Note:252285.1
    ORA-932 When Querying a Block Based on From-Clause-Query With CLOB

  • Contains clause in Interactive report search of a clob column

    Hi,
    I am using APEX Version 4.2.4.00.08
    How can an interactive Report use the contains clause when searching a clob column so that it uses the CONTEXT index?
    Thanks
    Chandra.

    I wrote it into the SQL used for the IR
    I created an APEX application that stores all of our IT's HOWTO documents. (word,excel,pdf)
    ctx_doc.snippet creates HTML code.
    select D.doc_id
      ,D.doc_filename
      ,dbms_lob.getLength( D.doc_blob ) as download
      ,decode( :P12_SEARCH, null, '-- nothing --',
             ctx_doc.snippet( 'IT_DATA.DOC_CTX_IX' -- my Oracle Text index name
                                 , D.doc_id, :P12_SEARCH )
       as snippet
    from it_data.documents D
    where :P12_SEARCH is null
    or contains( D.doc_blob, :P12_SEARCH ) > 0
    MK

  • What is the best way to search in a CLOB, in batch operation ?

    Hi All,
    My application runs batch for searching 'text' into clobs and accordingly inserts into another table-
    code snippet is like this -
    FORALL i IN 1 .. l_snme_sn_temp.COUNT
    INSERT INTO snme_rmanotes_out
    (report_request_id, serial_number, scrubbed_sn, product_id, pk1_value, last_update_date, event_date, event)
    SELECT pi_report_request_id
    , l_snme_sn_temp_orig (i)
    , l_snme_sn_temp (i)
    , '' product_id
    , pk1_value
    , TO_CHAR (last_update_date, 'DD-MON-YYYY') last_update_date
    , TO_CHAR (last_update_date, 'DD-MON-YYYY') event_date
    , 'IN RMA NOTES' event
    FROM c3_rma_notes
    WHERE contains (notes, l_snme_sn_temp (i)) > 0; **
    here - l_snme_sn_temp contains the text that the query searches ( also evident from the where clause, marked **), and is a variable of a TYPE.
    I am populating l_snme_sn_temp in a chunk of 500 +( using bulk collect limit 500)+ from a table having at least 1 million records +(and the upper cap will not be more than 1.5 M)+.
    The procedure that does this, takes 24+ hours to complete.
    If you guys have any better way to do this or any idea to tune to reduce time kindly suggest.
    I'd appreciate you kind response.
    regards,
    Raj Pandit

    Hi Herald,
    Thanks for writing.
    Oracle text index is there on 'notes' column. This table is part of petty big application of a huge company,
    so though I dont have access to it data dictionary tables, I can expect that the indexes are analyzed regularly.
    insert with HIT takes 2 mins
    insert with MISS takes less than 1 sec
    select with HIT takes minimum 2 mins and maximum 3 mins
    select with MISS takes less than a minute.
    It is expected that there would be more MISS then HITs ( HITs are not desirable)
    This source table is huge+(count in billions)+ and most of the clobs would be bigger. +(in most cases entire email conversation is stored in it)+.
    However there are many restriction on access, they have given us provision to see currently running query in a session ..
    when checked I found most of the time spent in executing insert+select only. As the entire query involves insert+select so I don't know which part is taking time.
    As much I know select + insert would be faster. The destination table+(having just one index)+ is merely used for this operation+(and have no other use in the application)+ only so there is no way insertion would be taking time. Also this procedure is just for insertion+(into that dest. table)+ no other operation is done
    Storage optimization is beyond my domain of discussion as we are just developers and organization is huge. There is no way DBA would listen to us unless there is an acute urgency hampering business operations. However in dev environment I analyzed the index but it didn't help.

  • How to search a string in clob?

    I have the following example Table (column description is a Clob):
    id title description
    1 test this is a large
    document with many
    chars above 4K.
    2 test2 test this is a test
    select * from mytable where description like '%with%';
    All the hours what i spent are not successful :-( Cause i know that
    you cannot search with "like" in a clob column. :-(
    Is there any way to search the data within the clob description and get all the
    information back ?
    I4m really new with Oracle...sorry for these kind of questions, but i say
    thank you very very much for every help!!

    I have a similar problem. I have read as much of the interMedia documentation, have indexes working successfully. However, the indexing seems sporadic - I can index smaller sets of characters, but where more that 4000 characters are present (and even some below this), I get no results back. I am using CLOBS, and the contains clause - as I say, the only difference seems to be the amount of text contained in the field.
    Would this be something to do with the text being stored in row, and the indexing failing due where a pointer is held instead?
    Any help vastly appreciated.
    Andrew

  • Searching in HTML-formatted CLOBs

    Me and my colleagues are designing a database where some HTML documents have to be saved. The two obvious options for that are :
    1. Storing the HTML in CLOB fields
    2. Saving HTML files on the server and storing only the filenames in the database
    I would prefer option 1, but we need to consider how fast string searches against all HTML files will perform.
    In option 2, we could use some Google-like search engine, and then query the database against the filename to get the relevant infos (author,creation date,...). This speaks in favour of generating the filename automatically from the table's primary key.
    In option 1, string search in CLOBs seems very fast from a little test I did, but we don't want to retrieve HTML tags, so we need a fast way of stripping these tags. I wonder whether there exists a facility for that in Oracle (or are regular expressions needed ?)
    So, what option sounds better ?

    Hi Dear,
    Did you look at Oracle Text capabilities ?
    http://download-west.oracle.com/docs/cd/B14117_01/text.101/b10730/toc.htm
    Instead of using
    where clob_col like '%QPG%'
    you could then use some kind of
    where contains(clob_col, 'QPG') > 0
    I think you will get no tag if you use the NULL_FILTER. Have a look. Maybe you could also post on the Text forum
    Regards
    Laurent

  • Search a CLOB column(contains XML) in Oracle table

    Hi,
    I need help on how will i be able to search the data in a clob column that contains XML in an ORACLE table.
    Thanks,
    PSS

    We are using 10g.. and database in which the table is located.. i just have a read only access .. so i am pulling all the data into a flat file (im using a shell script) and from there on i need to process the data... and my problem is how to pull the data in the CLOB using sql or whichever way.. if you can explain me with an example i would really appreciate it...
    Thanks,
    PSS

  • Searching CLOB column of XML documents with leading wildcard - Performance

    Hi, our table has a text indexed CLOB column of XML documents and when performing a search with a leading wild card, we never retrieve any results.
    The query looks like this:
    select id from <table> where contains(columnname, '(%12345)') > 0;
    I cant even generate an explain plan from this query. I killed it after 39 minutes.
    If the query changes to:
    select id from <table> where contains(columnname, '(12345%)') > 0;
    I get an explain plan immediately with a cost=2 and when I execute the query, I get results in less than a second.
    I'd appreciate any thoughts of what I should check or what the problem might be.
    Thanks! Doug

    Can you provide a script that reproduces the case. I am unable to reproduce the problem with just some small sample data, as shown below. That means that there is nothing wrong with the syntax, but you may be having problems due to the size of your data or other parameters that have not been mentioned.
    SCOTT@10gXE> CREATE TABLE your_table (id NUMBER, columnname CLOB)
      2  /
    Table created.
    SCOTT@10gXE> insert into your_table
      2  select 1, dbms_xmlgen.getxml
      3             ('select deptno, dname,
      4                   cursor (select empno, ename
      5                        from      emp
      6                        where  emp.deptno = dept.deptno ) employee
      7               from   dept
      8               where  deptno = 10')
      9  from   dual
    10  /
    1 row created.
    SCOTT@10gXE> SELECT * FROM your_table
      2  /
            ID COLUMNNAME
             1 <?xml version="1.0"?>
               <ROWSET>
                <ROW>
                 <DEPTNO>10</DEPTNO>
                 <DNAME>ACCOUNTING</DNAME>
                 <EMPLOYEE>
                  <EMPLOYEE_ROW>
                   <EMPNO>7782</EMPNO>
                   <ENAME>CLARK</ENAME>
                  </EMPLOYEE_ROW>
                  <EMPLOYEE_ROW>
                   <EMPNO>7839</EMPNO>
                   <ENAME>KING</ENAME>
                  </EMPLOYEE_ROW>
                  <EMPLOYEE_ROW>
                   <EMPNO>7934</EMPNO>
                   <ENAME>MILLER</ENAME>
                  </EMPLOYEE_ROW>
                 </EMPLOYEE>
                </ROW>
               </ROWSET>
    SCOTT@10gXE> CREATE INDEX your_idx ON your_table (columnname)
      2  INDEXTYPE IS CTXSYS.CONTEXT
      3  /
    Index created.
    SCOTT@10gXE> EXEC DBMS_STATS.GATHER_TABLE_STATS ('SCOTT', 'YOUR_TABLE')
    PL/SQL procedure successfully completed.
    SCOTT@10gXE> SET AUTOTRACE ON EXPLAIN
    SCOTT@10gXE> select id from your_table where contains (columnname, '(%839)') > 0
      2  /
            ID
             1
    Execution Plan
    Plan hash value: 2832585188
    | Id  | Operation                   | Name       | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |            |     1 |   888 |     0   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| YOUR_TABLE |     1 |   888 |     0   (0)| 00:00:01 |
    |*  2 |   DOMAIN INDEX              | YOUR_IDX   |       |       |     0   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("CTXSYS"."CONTAINS"("COLUMNNAME",'(%839)')>0)
    SCOTT@10gXE> SET AUTOTRACE OFF

  • Clob objects in search form

    Hello.
    I am trying to build a search form for my DB following the instructions of the "Developing Rich Web Applications with Oracle ADF" tutorial.
    One of the attributes I want to search (which is a field of a table in the DB) is of the type CLOB, but it is marked as non-queryable, and the checkbox is disabled so I cannot make it queryable.
    Is there any way to query CLOBs using the built-in search form? I know CLOBs can be queryed in Oracle.
    Thank you very much.

    Timo,
    You're confusing Oracle Text (or whatever it's called now) with CLOB datatype , although a text index on a clob column would be ok.
    You can use LIKE on clob columns, but not direct comparison with a string:
    SQL*Plus: Release 11.2.0.3.0 Production on Fri May 11 14:44:32 2012         
    Copyright (c) 1982, 2011, Oracle.  All rights reserved.                     
    Connected to:                                                               
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> create table john(x clob);                                             
    Table created.                                                              
    SQL> select * from john where x like 'foo%';                                
    no rows selected                                                            
    SQL> select * from john where x = 'xx';                                     
    select * from john where x = 'xx'                                           
    ERROR at line 1:                                                            
    ORA-00932: inconsistent datatypes: expected - got CLOB                      
                                                                                 John

Maybe you are looking for

  • XML file not loading...HELP!

    Hello, I'm working on a Magento template that includes a flashfile that loads a XML file. I'm getting the following error: XML FAILED TO LOAD! (undefinedtfile_main.xml) Fout bij openen van URL 'file:////Volumes/Macintosh%20HD/Users/ralreclame/Desktop

  • Using an infocube as a infosource to another info cube

    Hi, We are unable to create a link between two infocubes, one as a source for the other. We have used the option of "Generate Export Data Source" option on the source inforcube. While generating itself, it gives an ERROR msg below: "DataSource 8<srcC

  • Tab distance in Pages when using List and Tab

    Has anyone else noticed that sometime in the last update or 2 that the distance the TAB shortcut, or the --> arrow (under Inspector>List) moves the cursor is double the distance it used to be? The reason I noticed is because I have a few reports on t

  • How to se this corresponding prient out

    1.16     Correspondence Printing (Internal Document) Process Flow Menu Path     Accounting  Financial Accounting  General Ledger  Account  Correspondence  Request / Maintain Transaction Code     FB12 / F.64 Creation of Request of necessary docum

  • Running a command from java code

    hi all, There is a command "java -jar selenium-server.jar -interactive" which i am running through command prompt after going to D:\MyFolder\Examples . i want to execute this command using java code .please help