Indexing multiple columns in multiple tables

I have a multiple tables in which I want to search. I need to do text search that supports fuzzy logic for which I've currently set up a context index using the user_datastore. I also need to search columns such as numbers/dates/timestamps which from what I understand is not supported with the context search. I'm looking at setting up a second index of type ctxcat for this purpose - but I will need to index multiple columns in multiple tables. Is this possible?
Can someone advise on the best way to create indexes and search when a table schema such as the following exists. I've tried to keep it simple by just giving a few example columns and tables.
Order Table
- Has columns related to the order details - order name (varchar2), description (varchar2), date order placed (timestamp), date order completed (date), order amount (number), customer Id
Customer Table
- Has columns related to the customer information - customer name, address, city, state, telephone etc (all varchar2 fields)
Items Table
- Has details about the items being ordered - item name (varchar2), item description (varchar2), cost (number) etc
Order-Item Table
- Table that maps an order to the items in that order - orderId, itemId, quantity
Comments Table
- Logs any comments with the customer - comment description (varchar2), call type (varchar2), comment date (timestamp)
Currently with the Context index, I have it set up so I can search all text columns in all tables for a search term. This works fine.
I now need to be able to do more advanced searches, where I can search for a specific text in all orders as well as orders created after a certain date or orders above a certain amount or orders with a item quantity purchase of more that 10. The text has to be searched across the all text columns in all tables. How can I achieve this with Oracle Text?

There was a similar discussion with various ideas that may help you here:
How can I make CONTAINS query work for a date range

Similar Messages

  • Indexing multiple columns of multiple tables

    Hi,
    I'm trying to index multiple columns of multiple tables.
    As I have seen, the way to do this is using User_Datastore.
    have the tables to share a (foreign)key? My tables have only 2 or 3 similar columns(description, tagnr...)
    I want to get the different tagnr belonging to the same description etc.
    Can I do this?
    Has anyone a Samplecode indexing multiple tables?
    Any suggestion would be helpful.
    Arsineh

    A USER_DATASTORE works like this:
    create table A
    ( id number primary key,
    textA varchar2(100));
    create table B
    ( id number primary key,
    textB varchar2(100));
    procedure foo (rid in rowid, v_document in out varchar2)
    v_textA varchar2(2000);
    v_idA number;
    v_textB varchar2(2000);
    begin
    select id, textA
    into v_idA, v_textA
    from A
    where rowid = rid;
    select textB
    into v_textB
    from B
    where id = v_idA;
    v_document := textA | | ' ' | | textB;
    end;
    create preferences for USER_DATASTORE
    create index ...
    on table A ( text) ...
    you also can build on table B
    This depends where you want the
    trigger to be build to sync the
    documents.
    null

  • How to use a USER_DATASTORE to index multiple columns in different tables

    I would appreciate if somebody can give an example or point to links with examples on how to use USER_DATASTORE on multiple columns in different tables. THe Oracle Text documentation only shows multiple columns in the same table.
    Thanks in advance.

    I am not sure why your getting the wrong results but you should seriously reconsider the approach your are taking. Using functions like this is very ineffecient and should be avoided at all cost.

  • Sort functionality using MULTIPLE columns in a table control

    Hi all,
    I have a custom screen with table control.Now i need to provide SORT functinality in this screen for the columns in the table control.
    My questins:
    1.Is it possible to seelct MULTIPLE columns in a table control for SORTING?If yes,what explicit settings do i need to do while creatng the TABEL CONTROL in the screen?DO I need to select "Column selection " as MULTIPLE??
    2.How do I write the code for SORT functinonality for multiple columns?
    I know how to write the code for SORTING on basis of single column .
    Thanks!

    Hi Rob,
    Thanks for the reply.
    However I was thinking to apply the same logic as for single columns as follows:
    types : begin of ty_fields,
                c_fieldname(20),
               end of ty_fields.
    data  : t_fields type table of ty_fields,
               wa_fields like line of t_fields.
    WHEN 'SORTUP'.(Ascending)
          loop at TABLE tc01-cols INTO wa_tc01  where  selected = 'X'.
          SPLIT wa_tc01-screen-name AT '-' INTO g_help g_fieldname.
          wa_fields-c_fieldname = g_fieldname.
          append wa_fields to t_fields.
          endloop.
          describe table t_fields lines l_index.
          c_count = 1.
          if c_count  <= l_index.
          read table t_fields into wa_fields index c_count.
          case c_count.
          when '1'.
          l_field1 = wa_fields-c_fieldname.
          when '2'.
         l_field2 = wa_fields-c_fieldname.
        and so on depending on the no of columns in the table control...
          endcase.
          endif.
          SORT t_tvbdpl_scr BY  l_fields1 l_fields 2......l_fieldn.
    Let me know if the above method will work!Also for the above method to work will the type of fields(columns on whihc sort function will be applied) matter???
    Thanks again for your time.

  • How to update multiple columns from different tables using cursor.

    Hi,
    i have two tables test1 and test2. i want to udpate the column(DEPT_DSCR) of both the tables TEST1 and TEST2 using select for update and current of...using cursor.
    I have a code written as follows :
    DECLARE
    v_mydept1 TEST1.DEPT_CD%TYPE;
    v_mydept2 TEST2.DEPT_CD%TYPE;
    CURSOR C1 IS SELECT TEST1.DEPT_CD,TEST2.DEPT_CD FROM TEST1,TEST2 WHERE TEST1.DEPT_CD = TEST2.DEPT_CD AND TEST1.DEPT_CD = 'AA' FOR UPDATE OF TEST1.DEPT_DSCR,TEST2.DEPT_DSCR;
    BEGIN
    OPEN C1;
         LOOP
              FETCH C1 INTO v_mydept1,v_mydept2;
              EXIT WHEN C1%NOTFOUND;
              UPDATE TEST2 SET DEPT_DSCR = 'PLSQL1' WHERE CURRENT OF C1;
              UPDATE TEST2 SET DEPT_DSCR = 'PLSQL2' WHERE CURRENT OF C1;
         END LOOP;
         COMMIT;
    END;
    The above code when run says that it runs successfully. But it does not updates the desired columns[DEPT_DSCR].
    It only works when we want to update single or multiple columns of same table...i.e. by providing these columns after "FOR UPDATE OF"
    I am not sure what is the exact problem when we want to update multiple columns of different tables.
    Can anyone help me on this ?

    oops my mistake.....typo mistake...it should have been as follows --
    UPDATE TEST1 SET DEPT_DSCR = 'PLSQL1' WHERE CURRENT OF C1;
    UPDATE TEST2 SET DEPT_DSCR = 'PLSQL2' WHERE CURRENT OF C1;
    Now here is the upated PL/SQL code where we are trying to update columns of different tables --
    DECLARE
    v_mydept1 TEST1.DEPT_CD%TYPE;
    v_mydept2 TEST2.DEPT_CD%TYPE;
    CURSOR C1 IS SELECT TEST1.DEPT_CD,TEST2.DEPT_CD FROM TEST1,TEST2 WHERE TEST1.DEPT_CD = TEST2.DEPT_CD AND TEST1.DEPT_CD = 'AA' FOR UPDATE OF TEST1.DEPT_DSCR,TEST2.DEPT_DSCR;
    BEGIN
    OPEN C1;
    LOOP
    FETCH C1 INTO v_mydept1,v_mydept2;
    EXIT WHEN C1%NOTFOUND;
    UPDATE TEST1 SET DEPT_DSCR = 'PLSQL1' WHERE CURRENT OF C1;
    UPDATE TEST2 SET DEPT_DSCR = 'PLSQL2' WHERE CURRENT OF C1;
    END LOOP;
    COMMIT;
    END;
    Please let us know why it is not updating by using using CURRENT OF

  • Mapping multiple columns of a table to single dimension using odi

    Hi John,
    Can we map multiple columns of a table to a single dimnesion?
    For example, in RDBMS, for the employee details, Grade position etc will be in different columns, and in Planning these would be as members of one dimension.
    So while loading data from oracle to essbase can we map these multiple columns to single dimension?
    If yes how?

    Hi,
    In your staging area/target you can concatentate the columns.
    So in your interface and on your target datastore, pick the column which is going to hold the details of the concatenation.
    Then in the expression editor use the CONCAT function, or you could use ||
    eg CONCAT(<sourceCol1>, <sourceCol2>)
    or <sourceCol1> || <sourceCol2>
    obviously you need to change the information between <sourceCol1> to your source datastore column
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Index Multiple Column of Multiple Tables

    Hi All,
    I would like to know how to create a index which can search through all column in my database tables. Eg: I have 30
    tables and every tables have around 10 columns. I want to create a index which can search through the columns in
    these tables.
    I know that User_DataStore can helps in create multiple column search across multiple tables. But in my case the BLOB
    created will be very huge. Any work around? I mean is there any solutions like concatenated datastore?
    Thank You.
    Regards,
    LG Tan

    Hi,
    I figured out how to do this today. The first thing is that the type of index you need is a USER_DATASTORE.
    The idea behind this type of index is pretty straight forward but the documentation does a very good job of not drawing attention to just how powerful it is.
    The idea behind a USER_DATASTORE is that you can write your own stored procedure to extract the data that you want to index and return it to the indexer. Take an example where you have a master table which contains enough information to allow you to find associated data in other tables i.e. a shared key. The idea is that when you set up a USER_DATASTORE index, you specify the name of a stored procedure that the indexer will call for each row in the master table. The stored procedure has one input and one output parameter, rowid (in) and clob (out).
    When the index is created, the stored procedure you specify is, as I said above, called for each row in the master table. Your stored procedure uses this ROWID to extract the shared key (this can be anything you want) from the master table and uses this to build the necessary SELECT statement to retrieve the related data from the other tables. The rest of the stored procedure simply appends the data returned from your select statement to the return CLOB. The indexer then indexes the inforamation in this CLOB and discards the data.
    The index can of course only return hits against the master table. It's up to your application to extract shared key from the returned row(s), bind to the other tables and present the results.
    You will find a basic example of how to implement USER_DATASTORES in the Oracle Text Reference Guide (http://download.oracle.com/otndoc/oracle9i/901_doc/text.901/a90121.pdf). Feel free to email me if you want some example code.
    Dean

  • I am unable to sort multiple columns in a table created in Pages.

    I had been using Appleworks up until I installed Lion and have now switched to iWork. I created a table within a Pages document and am able to sort a single column (using the Table Inspector and choosing Sort from  Edit Rows and Columns) but the Sort option is grayed out when I attempt to sort multiple columns.
    In another post, someone talked about this being a problem if you have merged fields. I do not believe I have done this (to be honest I don't know the function of merging fields).
    This is very frustrating as I was easily able to sort these tables in Appleworks.

    Sharon Anderson wrote:
    Thanks for your quick response! I have been trying that but then found that Numbers would only let me print in landscape view so I had to paste the table back into Pages. Is there a way to print in portrat view (from Numbers?)
    Not so. In the lower left corner of the window, there's an icon that looks like a piece of paper. If you see this:
    you are in Sheet View, or normal, mode. If you see this:
    You are in Print View mode. Now you see the icons for portrait and landscape modes. Click your choice. Then arrange your content to fit the pages as you wish.
    Jerry

  • Count(*) , group by with multiple columns from multiple tables involved

    Hi all,
    I am relatively new to SQL.
    Currently I have these few requirements, to display quite a number of fields from 3 tables for display of report.
    In my query I need to:
    1.) count(*)
    2.) select quite a number of fields from table 1,2,3
    However when count(*) is used, grouped by has to be used to.
    How do I actually use group by with so many columns to be selected?
    I have actually used the query below, but the count(*) returns 1, the correct output should be 3 instead.
    select count(*), table1.col1, table1.col2, table1.col3, table2.col3, table2.col4, table2.col6, table3.col1, table3.col4, table3.col5
    from table1, table2, table3
    where
    <conditions>........................
    group by table1.col1, table1.col2, table1.col3, table2.col3, table2.col4, table2.col6, table3.col1, table3.col4, table3.col5
    I know this group by statement looks very unrefined. How can I select multiple fields from different tables, and yet get the count(*) correctly?
    Thank you so much for your time.

    Hmm yes it actually does return count as 1 for each row. But there are 3 rows returned. E.g.
    ctr table1.col1 table1.col2 ..........
    1 value1 value1
    1 value2 value3
    1 value3 value4
    If I put the count(*) outside, it returns 3 , the correct output
    ctr
    3
    select count(*) from
    select table1.col1, table1.col2, table1.col3, table2.col3, table2.col4, table2.col6, table3.col1, table3.col4, table3.col5
    from table1, table2, table3
    where
    <conditions>
    group by table1.col1, table1.col2, table1.col3, table2.col3, table2.col4, table2.col6, table3.col1, table3.col4, table3.col5
    Thus I was wondering if it was the group by of multiple colns that resulted in the count stucked at value 1.

  • Stored procedure in  package return multiple columns from multiple tables

    Hi ,
    Can a single stored procedure return multiple column values from different tables.
    example:
    tabA: col2, tabB:col3,tabC:col4 etc.
    one more question:
    if a stored procedure like to return 10 columns for a particular record from a single table do i need to define a TYPE statement for each colum like
    TYPE col1 is TABLE of varchar
    TYPE col2 is TABLE of varchar
    here i want to return only one row, not many rows.
    thanks

    You can try one procedure with OUT or IN/OUT parameters that collect the values from one or more sql statements.
    CREATE OR REPLACE PROCEDURE P1
    (P_COD IN TABLE.COD%TYPE,
    P_DESC1 OUT TABLE1.DESC1%TYPE,
    P_DESC2 OUT TABLE2.DESC2%TYPE)
    IS
    BEGIN
    SELECT table1.DESC1, table2.DESC2
    INTO P_DESC1, P_DESC2
    FROM TABLE1, table2 WHERE
    table1.COD = P_COD and
    table1.cod = table2.cod ;
    END P1;
    JP

  • Select Query where multiple column in multiple values (cant use in clause)

    I can use (in clause) with on column like this:
    Select code from table where code in(1,2,3)
    -------------------------------My case:-------------------------------------------------
    I’ve 4 columns PK of table as below 
    I need to :
    select
    where (code, month, year) in ((1,1,2013) and (2,1,2014) and (2,2,2015))
    i can't write it this way :
    select where code in (1,2) and month in (1,2) and year in (2013,2014,2015)
    case i'll get my rows but others included like (1,1,2015) , (1,1,2014),(2,1,2013) .. etc
    I’m terribly want to solve this problem
    Please help me
    Code (pk)
    Month (pk)
    Year (pk)
    emp_code(pk)
    1
    1
    2013
    101
    1
    1
    2013
    102
    2
    1
    2013
    101
    2
    1
    2013
    102
    1
    2
    2013
    101
    1
    2
    2013
    102
    2
    2
    2013
    101
    2
    2
    2013
    102
    1
    1
    2014
    101
    1
    1
    2014
    102
    2
    1
    2014
    101
    2
    1
    2014
    102
    1
    2
    2014
    101
    1
    2
    2014
    102
    2
    2
    2014
    101
    2
    2
    2014
    102
    1
    1
    2015
    101
    1
    1
    2015
    102
    2
    1
    2015
    101
    2
    1
    2015
    102
    1
    2
    2015
    101
    1
    2
    2015
    102
    2
    2
    2015
    101
    2
    2
    2015
    102
    thank you

    In T-SQL you have to use OR-ed predicates. 
    In full ANSI Standard SQL youcan write row comparisons  (a,b,c) = (1,2,3) etc! but not in T-SQL dialect. Ignoring that problem, what you have is a design flaw called attribute splitting; you have put one unit of measurement
    in two columns. 
     I like the MySQL convention of using double zeroes for months and years, That is 'yyyy-mm-00' for a month within a year and 'yyyy-00-00' for the whole year. The advantages are that it will sort with the
    ISO-8601 data format required by Standard SQL and it is language independent. The pattern for validation is '[12][0-9][0-9][0-9]-00-00' and '[12][0-9][0-9][0-9]-[01][0-9]-00'
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • How to transpose rows into multiple columns using pivot table

    I have 1 row containing 12 columns with value "JAN", "FEB", "MAR", "J-1","F-1","M-1","J-2","F-2","M-2","J-3","F-3","M-3"
    I want to display as
    JAN J-1 F-1 M-1
    FEB J-2 F-2 M-2
    MAR J-3 F-3 M-3
    How do I achieve the above?

    Today you have only 3 months JAN, FEB, MAR. Is it always the same number of columns. What if there are more months added to this row?
    Is your data really coming from relational source or some sort of text file?
    There is a better way to do this in narrative view using HTML if your requirement is just to show them in multiple rows and do some calculations.
    Go to Narrative View;
    In prefix, use <html> <table>
    In 'Narrative' text box add something like this
    <tr> <td> @1 </td> <td> @4 </td> <td> @7 </td> </tr>
    <tr> <td> @2 </td> <td> @5 </td> <td> @8 </td> </tr>
    <tr> <td> @3 </td> <td> @6 </td> <td> @9 </td> </tr>
    In Suffix, use </table> </html>
    You can also add simple calculations like sum etc at the very bottom of these rows as grand totals.
    kris

  • Need to update multiple columns using another table

    I have 2 tables. and i need to update rows of 1 table using another table
    Table1
    Serial_no.     payment_date     Payment_amt
    101     22/11/2010     150
    101     18/03/2011      355
    102     15/04/2011      488
    103     20/05/2011      178
    102     14/06/2011      269
    101     28/06/2011      505
    Table2
    Serial_no     Charge_amt      Last_paymt_dt     Last_paymt_amt
    101     255
    102     648
    103     475
    I want to update Last_paymt_dt and Last_paymt_amt of table2 using Table1, I have written following update statement but it gives error that single row subquery return multiple row.
    Update Table2
    set (Last_paymt_dt,Last_paymt_amt) = (select max(payment_date, payment_amt) from table1
    where table1.Serial_no = table2.Serial_no group by payment_amt)
    kindly suggest how should i update.

    SQL> select * from table1
      2  /
    SERIAL_NO PAYMENT_DA PAYMENT_AMT
           101 22/11/2010         150
           101 18/03/2011         355
           102 15/04/2011         488
           103 20/05/2011         178
           102 14/06/2011         269
           101 28/06/2011         505
    6 rows selected.
    SQL> select * from table2
      2  /
    SERIAL_NO CHARGE_AMT LAST_PAYMT LAST_PAYMT_AMT
           101        255
           102        648
           103        475
    SQL> update  table2
      2     set  (last_paymt_dt,last_paymt_amt) = (
      3                                            select  max(payment_date),
      4                                                    max(payment_amt) keep(dense_rank last order by payment_date)
      5                                              from  table1
      6                                              where table1.serial_no = table2.serial_no
      7                                           )
      8  /
    3 rows updated.
    SQL> select * from table2
      2  /
    SERIAL_NO CHARGE_AMT LAST_PAYMT LAST_PAYMT_AMT
           101        255 28/06/2011            505
           102        648 14/06/2011            269
           103        475 20/05/2011            178
    SQL> SY.

  • Can I update 2(or multiple) columns in a table based on one of update col?

    Hi All,
    I have a table emp:
    empno number
    ,salary number
    ,comm number
    Now, the comm column is always a % of the salary column (but still would like to store the comm in the table as a column).
    Assuming that someone get a salary increment and I need to update the commission as well based on the new salary value, should I still use 2 update statements or is there anyway, I can achive in a single update clause itself?
    example:
    if the old values were:
    =============
    1234 10000 1000
    and if I do the following,
    update emp
    set salary = salary + 3000
    ,comm = salary * 10/100
    where empno = 1234;
    the comm value still points to the old salary value and the table looks like:
    emp:
    ===
    1234 13000 1000
    instead of:
    1234 13000 1300 (10% of the new salary - 13000)
    so, the only way to achieve this is to issue 2 update statements? Or is there any way of achieving in one single update statement? Please let me know.
    Am on Oracle 10.2.0.3.0.
    Thanks,
    Srini.

    Or you could create a after update trigger on salary column that updates comm whenever Sal updates.
    What happens if someone else issues an update on salary and forgets to update the commission? Wont you have incorect data then?
    Also, commision is a redundant column . I dont think it is a good idea to have computed values as a separate column.
    Thanks,
    Rajesh,

  • How to disaply multiple column of a table in a single flex datagrid column

    Hi,
    I have a table in my database which has say 3 column (Firstname,LastName,Location). I wanted to display these 3 different values in a single column in flex datagrid.
    Could you please help me out in this
    Thanks,
    Pratik

    Generally, in such scenarios each column is made corresponding to the column in database only and not single column.
    However, we can setStyle of a datagrid to make it appear as if all three  columns have been populated in single.
    set verticalGridLines="false" for dataGrid. Further cosmetic changes can be made to realise the required look.
    In some cases, labelFunction of a datagridColumn also suffices the need.
    Tanu

Maybe you are looking for

  • D-link 524, appletalk and printing

    hi! i am trying unsuccessfully to print via wireless d-link router to my old laserjet... my setup: powerbook g4 12" [linking via airport to:] d-link524 wireless router [ethernet connection from back of above router to:] hp laser jet 2100tn [which wor

  • Need Suggestion on buying macbook pro retina display

    No macbook pro retina is announced at WWDC. I want to buy one so I need suggestion, Should I wait or buy the existing one?

  • How to add an extra page to the index.html page on dreamweaver CS6?

    How to add an extra page to the index.html page on dreamweaver CS6?

  • My iPad fell & no more wifi connections :(

    I used to connect with my home wifi easily until it fell down, it doesn't show any networks under "choose a network" although am near the modem. I tries reseting the network, didn't work .. Anything I can do ?

  • Corrupted backup files

    Hi, I've only had my BlackBerry Curve 9300 for a couple of months and I'm having problems backing up to my computer. The backup always appears to have been successful (i.e. shows the 'Your backup is complete' message) but when I go to look at the bac