User Datastore for multiple tables and columns!

Hi,
I hop so much, someone can help me.
I've made a user datastore to index multiple columns of multiple tables.
Now, the Documentation of Oracle explains the idexing of one table.
I have multiple tables, which have all, the columns descr and tagnr. I want to make a query sth like this:
select table1.column, table2.columnd... where contains(indexed field,'gas within descr',1)>0
is it possible to index 4 seperate tables, without having a collective key? I dont want to make a Concatenated Datastore.
I have wrote this code.
But it doesn't work. It's been compiled fine. But I don't get any result with my queries.
create or replace
procedure My_Proc_Wide
Must be in ctxsys schema.
In a full-scale example, this would be a wrapper
for a proc in the user schema.
rid in rowid,
tlob in out NOCOPY clob /* NOCOPY instructs Oracle to pass
this argument as fast as possible */
is
v_descr varchar2(80);
v_tagnr varchar2(30);
v_descr_name constant varchar2(20) := 'descr';
v_descr_start_tag constant varchar2(20) := '<' || v_descr_name || '>';
v_descr_end_tag constant varchar2(20) := '</' || v_descr_name || '>';
v_tagnr_name constant varchar2(20) := 'tagnr';
v_tagnr_start_tag constant varchar2(20) := '<' || v_tagnr_name || '>';
v_tagnr_end_tag constant varchar2(20) := '</' || v_tagnr_name || '>';
v_buffer varchar2(4000);
v_length integer;
begin
/* verify the env which called this */
if Dbms_Lob.Istemporary ( tlob ) <> 1
then
raise_application_error ( -20000,
'"IN OUT" tlob isn''t temporary' );
end if;
/* the real logic */
/* first tabel to be indexed */
select t1.tagnr, t1.descr
into v_tagnr, v_descr
from tweb.pdp_positions t1
where t1.rowid = rid;
v_buffer := v_tagnr_start_tag ||
v_tagnr ||
v_tagnr_end_tag ||
v_descr_start_tag ||
     v_descr ||
     v_descr_end_tag;
v_length := length ( v_buffer );
Dbms_Lob.WriteAppend(tlob, length(v_buffer) + 1, v_buffer || ' ');
/* second table to be indexed */
select t2.tagnr, t2.descr
into v_tagnr, v_descr
from tweb.pdp_schema_equ t2
where t2.rowid = rid;
     v_buffer := v_tagnr_start_tag ||
v_tagnr ||
v_tagnr_end_tag ||
v_descr_start_tag ||
     v_descr ||
     v_descr_end_tag;
v_length := length ( v_buffer );
Dbms_Lob.WriteAppend(tlob, length(v_buffer) + 1, v_buffer || ' ');
/*third table to be indexed */
select t3.tagnr, t3.descr
into v_tagnr, v_descr
from tweb.pdp_equipment t3
where t3.rowid = rid;
     v_buffer := v_tagnr_start_tag ||
v_tagnr ||
v_tagnr_end_tag ||
v_descr_start_tag ||
     v_descr ||
     v_descr_end_tag;
v_length := length ( v_buffer );
Dbms_Lob.WriteAppend(tlob, length(v_buffer) + 1, v_buffer || ' ');
/* fourth table to be indexed */
select t4.tagnr, t4.descr
into v_tagnr, v_descr
from tweb.pdp_Projcode t4
where t4.rowid = rid;
     v_buffer := v_tagnr_start_tag ||
v_tagnr ||
v_tagnr_end_tag ||
v_descr_start_tag ||
     v_descr ||
     v_descr_end_tag;
v_length := length ( v_buffer );
Dbms_Lob.WriteAppend(tlob, length(v_buffer) + 1, v_buffer || ' ');
end My_Proc_Wide;
what have I to do, to make this work?
Any Help would be appriciated!!
Kind Regards,
Arsineh

Arsineh,
I realise that it has been quite some time since you posted this question but I thought I'd reply just in case you never did manage to get your user datastore working.
The reason your procedure will not work is simple. A user datastore procedure accepts a rowid input parameter. The rowid is the ID of the row that Oracle Text is currently trying to index. In the example you have given, you are attempting to use the supplied rowid as the primary key for multiple tables, this will simply never work as the rowid's across multiple tables will never correspond.
The best way to achieve your goal is to create the index on a master table which contains the common primary keys for each of your four tables e.g.
MASTER_TABLE
COL:COMMON_KEY (NUMBER(n))
COL:USER_INDEX_COLUMN (VARCHAR2(1))
If you create the user datastore index on the MASTER_TABLE.USER_UNDEX_COLUMN column your stored proc simply needs to read the correct row from the MASTER_TABLE (SELECT t.common_key into v_CommonKey FROM master_table t WHERE t.rowid = rid) and issue subsequent queries to extract the relavant data from the t1..t4 tables using the common key e.g.
SELECT t1.tagnr, t1.descr into v_tagnr, v_descr FROM t1 WHERE t1.[PRIMARY_KEY_FIELD] = v_CommonKey;
SELECT t2.tagnr, t2.descr into v_tagnr, v_descr FROM t2 WHERE t2.[PRIMARY_KEY_FIELD] = v_CommonKey;
and so on...
Hope this helps
Dean

Similar Messages

  • Data in multiple tables and columns

    Hi,
    How to find if multiple tables are containing the same data?
    'Apple' text is in three different tables and under three different column names.
    Expected result
    fruits_one
    fruits_two
    fruits_three
    Select name, quantity from fruits_one;
    Apple   1
    Orange  1
    Pear    1
    select flavour, desc from fruits_two;
    Red,   Apple
    Blue, Berry
    select order,date,details  from fruits_three;
    101  11/11/2011    Grapes
    102  12/01/2010    AppleThanks
    Sandy

    SQL> create table fruits_one (name varchar2(100), quantity number);
    Table created.
    SQL> insert into fruits_one
      2  select 'Apple'  name, 1 quantity from dual union all
      3  select 'orange'  name, 1 quantity from dual;
    2 rows created.
    SQL> commit;
    Commit complete.
    SQL> create table fruits_two (flavour varchar2(100), des varchar2(100));
    Table created.
    SQL> insert into fruits_two
      2  select 'Red' flavour,   'Apple' des  from dual union all
      3  select 'blue' , 'berry'  from dual ;
    2 rows created.
    SQL> commit;
    Commit complete.
    SQL> set serveroutput on
    SQL> declare
      2  l_search varchar2(10) := 'APPLE';
      3  l_cnt number := 0;
      4  begin
      5 
      6  for x in (select column_name, data_type, table_name from user_tab_cols where data_type in ('VAR
    CHAR2'))
      7  loop
      8     
      9    execute immediate  'select count(*) from "' || x.table_name ||'" where upper("' || x.column_n
    ame || '") like ''%' || l_search || '%''' into l_cnt;
    10   
    11    if l_cnt > 0  then
    12    dbms_output.put_line('table = "' || x.table_name ||'", column = "' || x.column_name ||'"');
    13    end if;
    14   
    15  end loop;
    16 
    17  end;
    18  /
    table = "FRUITS_ONE", column = "NAME"
    table = "FRUITS_TWO", column = "DES"
    PL/SQL procedure successfully completed.
    SQL>

  • Build dynamic query depending upon selection of table and columns

    Hi ,
    I want your views on following requirement :
    we r doing generic export to excel functionality .
    1.User will select multiple tables and according to tables ,columns on that table will select
    2.There can be multiple table
    3.depending upon column and table selection , we have to build dynamic query and execute .
    Please let me know is it possible .If yes then please tell me how to do above requirement.
    Thanks in advance

    Hi,
    Identifiers cannot be used as bind variables, query are parsed
    before evaluate bind variables. Identifiers like table name.
    For excel you can use some like this:
    SET MARKUP HTML ON ENTMAP ON SPOOL ON PREFORMAT OFF
    SPOOL test_xls.xls
    SELECT colum1||chr(9)||columN FROM tableName;
    or CSV:
    SELECT colum1|| ',' ||columN FROM tableName;
    SPOOL OFF
    SET MARKUP HTML OFF ENTMAP OFF SPOOL OFF PREFORMAT ON
    For construct the query i suggest to read "Dynamic SQL Statements":
    http://www.java2s.com/Tutorial/Oracle/0440__PL-SQL-Statements/0300__Dynamic-SQL.htm
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/dynamic.htm
    http://docs.oracle.com/cd/B10500_01/appdev.920/a96590/adg09dyn.htm
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:227413938857
    --sgc                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Help with adding a table and column which are strings to a database

    I want to add a column and table into a database.
    I want to do this both for the Table and Column.
    I want (Data) and Test to be replaced with my strings.
    String MyData = "My column"; // This will change at times.
    String MyData2 = "My table";
    String sql = "Insert into Test (Data) Values (?)";     
    How can I change (Data) and Test to add variables "MyData" and "MyData2".
    Thanks.

    This is a fairly short intro to JDBC that gives the details:
    http://java.sun.com/docs/books/tutorial/jdbc/basics/index.html

  • The new table and Columns to look for in picking headers, etc

    Hi,
    What are the new tables and columns to look for mapping the following old ones:
    1) Pick_Slip_Number from So_Picking_Headers,
    2) Sequence_Number from SO_Picking_lines
    3) Line_ID from So_Note_References
    Thanks and Regards,
    Praveen

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by ravi alladi ([email protected]):
    Actually would it be possible to get a list of all changes in Order Management between 11 and 11i? ie what tables added, what have been modified and which ones are obsolete<HR></BLOCKQUOTE>
    Ravi
    Actually, we are working on that same analysis. If you receive any responses, please forward to myself as well.
    Thank you
    Sha Green

  • Populate multiple rows and columns based off of a single cell

    Does anyone know a way to populate multiple rows and columns based off of the input of a single cell. I'm trying to create a workout tracker that auto populates from a master list of workouts. Example, in A2 the user selects the workout from a drop down menu (St1, St2, St3, etc) and the workout is pulled from the master list and is populated into B2:C5.
    I'm using =LOOKUP(A2,Master :: A2:A32,Master :: C2:C32) right now, but it's only drawing the top column. I'm looking for an edit for the formula (or completely new formula) that will place the info from the 1st column of the Master table into the 1st column of the Auto Tracker 1 table and then on down until the 4th column.
    Here is a screen shot of what I have now:
    And an example of what I'd like to accomplish:
    Any and all help is appreciated, and please let me know if there is any more info that I can give that'd help out.

    Hi Mike,
    Your screenshots show that you have merged some cells in Column A of both tables. That may be the reason why the LOOKUP function is having trouble working out which range of cells to examine.
    Hope this helps.
    Regards,
    Ian.

  • Can we use single DB Adapter for multiple tables

    Hi,
    I have 3 tables. ONE is the Master table and other 2 tables having Primary and foreign key relationships with the Master Table.
    Data is enter in the Tables 2 & 3 (based on Master Table Primary key)
    I have to use a DB Adapter in BPEL Process which will be in Transaction (what type of Transaction is Best in such a Scenario).
    - How do i implement it in BPEL.
    - Can i use a Single DB Adapter for Multiple Tables ? (*Views* should not be created for tables 1, 2 & 3),
    as we want to avoid using multiple DB Adapters, as in future Tables may increase or decrease...
    - while in Transaction if Table 2 fails in Inserting / Updating, it should roll back on error and also if Table 3 fails in Inserting / Updating, it should roll back table 2 and Table 3.
    - how access to concurrent users is maintained / managed in such a scenarios.
    But everything should be done using Single DB Adapter without creating a separate view.
    Is this Possible in BPEL..
    If not, How do we design, Implementation such a BPEL Process in Transaction with a best in Performance (both BPEL Process & DB Resources)
    thanks in advance
    thanks & regards,
    anvv sharma

    Hi,
    Thanks for your quick response.
    I have few quires.
    If we use PL/SQL, how do we implement transaction and Exception Handling appropriately based on the Error / Exception in BPEL.
    If the Table 2 or Table 3 gives out Error / Exception, i have to handle it separately and intimate accordingly.
    Suppose, if Table 2 got Error / Exception - Error Handling would be 'Roll back due to error in Table2'
    Thanks & regads,

  • Can we hide the tables and columns from subject areas in the front end

    Hi,
    Is there any way to hide the tables and columns from the subject area in front end.I need to create a report with some tables which the user does not want to see.So after creating the reprot can I hide those tables and columns in the front end

    Hi,
    Your question is not that clear to me...do you want to hide the entire table/column that dont want to show up in the front end then you could do in Presneation Layer in the RPD by going Permissions in the property of that object.
    But if you want to hide the column in the report that can be visible in the subject Area: go to column properties -> Column fomat...thereis Hide option.
    Can you please elaborate your question...what exactly you are looking for...
    --SK                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Including table and column comment in the Data Modeler

    Hi all,
    I used Oracle's SQL Developer Data Modeler (Version 3.0.0.665) and created a data model for my project. I e-mailed a PDF format of the data model to our Systems Analyst. She asked if I could re-create the data model and include table and column comments. Is this a possibility and if so how is this done?
    Thank you for your input,
    Seyed

    Hi Kent,
    Using the information you provided and Oracle’s Working with SQL Developer Modeler Reporting I did the following:
    1) Created a Reporting Schema User
    1.1) Using my Oracle 10g Personal Edition, I created a new user and gave him DBA administrative privileges
    2) Exported Relational Design to Reporting Schema
    2.1) Opened the Relational Design
    2.2) Exported it to the Reporting Schema. Note, I never got a message ‘Design has been exported successfully’.
    3) Reviewed the Report Results
    I think exporting the relational design was not successful, and didn’t get any error messages. Had step 2 completed successfully, I would have reviewed the Report Results in SQL Developer. By the way, I know I have marked this topic as closed, but would like to learn your method too.
    Thank you for your help,
    Seyed

  • Extract schema/metadata - names for all tables and attributes

    Hi, I am quite new to Oracle DB (only been doing dev mostly with sqlserver before). Is there a way to extract schema (names for all tables and attributes) for 10g and 11g in application code (either java or .net) or pl/sql?
    Thank you,
    -Tony

    There are built in views that start with DBA_, ALL_, and USER_. All means all the user can see, user means all the user has, and dba means everything, which generally means the same as the others plus an owner. So you can desc user_tables to see what-all that view has, then select columns from the view with ordinary sql. See the doc set for all the views available, interesting ones are ...views, ...objects, ...tab_cols and so forth.
    There are also built in procedures for getting metadata, google for details.
    Many tools have easy GUI's for this too. EM has ways on the administration screen to get to various objects, and then you can show the ddl. Maybe sqldeveloper has something too.

  • Toplink changes table and columns to uppercase

    I found a way to make toplink not to change table and columns to upercase with setShouldForceFieldNamesToUpperCase=false setting (which should be false be default but so some reason isn't.)
    However, when toplink is used with JSF how can setShouldForceFieldNamesToUpperCase be set to false? Is there a way to do it in persistence.xml or perhaps there is a better way altogether? (I know i can use @Table and @Column but that is a lot of redundant code if all the fields in java have exact match in DB and i am looking for a cleaner solution.)
    My setup is a follows
    toplink v2-b49
    mysql 5.0 (with 5.0.5 driver)
    servlet/jsp 2.5/2.1
    jsf 1.2
    tomcat 6.0.13
    Thanks

    Thanks Doug
    I Created that class with
         public void customize(Session session) throws Exception {
              session.getDatasourceLogin().getPlatform().setShouldForceFieldNamesToUpperCase(false);
    But that doesn't help. Then I checked if it is being set correcly and saw that it is false even before I set it, so the default works as advertised and the var is false.
    So i guess this is not the problem. Any idea what can cause it?
    here is the class
    @Entity
    @Table(schema="jpaTABLE")
    public class User {
         @Id
         private int ID;
         private String Name;
         private String Password;
         private String Status;
    public User() {}
    geters...
    setters...
    here is the code
    Query q = em.createQuery("SELECT u FROM User u WHERE u.Name = :name AND u.Password = :password");
    here is the error
    [TopLink Fine]: 2007.06.07 04:20:24.636--ServerSession(9017297)--Connection(17227669)--Thread(Thread[http-8080-1,5,main])--SELECT ID, NAME, PASSWORD, STATUS FROM jpaTABLE.USER WHERE ((NAME = ?) AND (PASSWORD = ?))
         bind => [abc, 123]
    [TopLink Warning]: 2007.06.07 04:20:24.682--UnitOfWork(14633980)--Thread(Thread[http-8080-1,5,main])--Local Exception Stack:
    Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0 (Build b49-beta3 (05/31/2007))): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 'jpaTABLE.USER' doesn't exist
    Error Code: 1146
    Call: SELECT ID, NAME, PASSWORD, STATUS FROM jpaTABLE.USER WHERE ((NAME = ?) AND (PASSWORD = ?))
         bind => [abc, 123]

  • Displaying table and column names

    i have a user that created a table, he is not sure of the name of the table. how do i display a list of tables and display the column names within a table??

    You would need to know who the user is, or alter the following script.
    The script waits for 2 entries:
    1- the tablenames that start with the first characters entered;
    2- the columns that start with the first characters entered;
    (If you want to search for "any" tables and/or columns that contain the charatcers you enter, preceed the parameters entered with a % sign).
    (If you want to search for "any" table or character, do not enter anything.
    This is a "raw" script that should do job. I think it should do the minimum you are looking for.
    SET PAGESIZE 50
    SET LINESIZE 120
    SET TIMING ON
    COLUMN OWNER HEADING 'OWNER' FORMAT A12
    COLUMN TABLE_NAME HEADING 'TABLE NAME' FORMAT A30
    COLUMN COLUMN_NAME HEADING 'COLUMN NAME' FORMAT A30
    COLUMN DATA_TYPE HEADING 'TYPE' FORMAT A10
    COLUMN DATA_PRECISION HEADING 'PREC' FORMAT 99G999
    COLUMN DEFAULTVAL HEADING 'DEF VALUE' FORMAT A10
    COLUMN INDEX_NAME HEADING 'INDEX NAME' FORMAT A30
    COLUMN INDEX_TYPE HEADING 'TYPE OF INDEX' FORMAT A27
    COLUMN UNIQUENESS HEADING 'UNIQUE' FORMAT A3
    COLUMN PARAMETERS HEADING 'PARAMETERS' FORMAT A500 NEWLINE
    -- Query
    SELECT DISTINCT --COUNT(*)
    C.TABLE_NAME,
    C.COLUMN_NAME,
    C.DATA_TYPE,
    C.DATA_LENGTH,
    C.DATA_PRECISION
    FROM ALL_TAB_COLUMNS C,
    ALL_CONS_COLUMNS CC1
    WHERE
    (C.COLUMN_NAME = CC1.COLUMN_NAME(+)
    AND UPPER(C.TABLE_NAME) = UPPER(CC1.TABLE_NAME(+)))
    AND UPPER(C.TABLE_NAME) LIKE UPPER('&PARAM1%')
    AND UPPER(C.COLUMN_NAME) LIKE UPPER('&PARAM2%')
    --AND OWNER = 'SYS'
    --AND DATA_TYPE = 'DATE'
    --AND DATA_TYPE != 'CLOB'
    --AND DATA_TYPE != 'LONG'
    ORDER BY C.TABLE_NAME, C.COLUMN_NAME;
    Hope this helps.

  • When will Excel Support Tabular Model Table and Column Descriptions via Tool Tip or other display mechanism

    I have noticed that SSMS supports tool tips for the Tabular Model (tables and columns) however Excel 2013 doesn't appear to.   This is a very important feature to our end users.
    Does anyone know when this will be supported?
    Thanks
    M Meyer

    Hi Meyer,
    According to your description, you want to use the tooltip function in Microsoft Excel for the SQL Server Analysis Services Tabular model, right?
    I have tested it on my local environment (Microsoft SQL Server 2012 SP1 and Excel 2013), the result is that the feature is not supported currently. It's hard to say the detail date when this will be supported. If this feature is enabled, Microsoft will announce
    it on the document.
    Besides, if you have any concern about this behavior, you can submit a feedback at
    http://connect.microsoft.com/SQLServer/Feedback and hope it is resolved in the next release of service pack or product. Your feedback enables Microsoft to make software and services the best that
    they can be, Microsoft might consider to add this feature in the following release after official confirmation.
    Regards,
    Charlie Liao
    TechNet Community Support

  • Jdbc tables and columns

    hi
    Im trying to write a small jdbc program that retrieves all the tables in an MS Access database...so far so good.
    DatabaseMetaData dbMetaData = con.getMetaData();
    ResultSet rs = dbMetaData.getTables(null,null, null, new String[]{"TABLE"});Now for every table name I want to retrieve the column names and display them to the user.I have tried using
      ResultSet rs1=dbMetaData.getColumns(null,null, null,null);But this retrieves ALL the columns for every table and stores them in the resultset and Im not sure how I can just retrieve the columns for each individual table.
    Any ideas?

    Ive also tried this
    rs = dbMetaData.getTables(null,null, null, new String[]{"TABLE"});     
    while(rs.next()){
         System.out.print(rs.getString(3)+"|");
         rs1=dbMetaData.getColumns(null, null, rs.getString(3), null);
         System.out.print(rs1);
         and get this error-
    Customers|java.sql.SQLException: No data found
    at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcResultSet.getString(Unknown Source)
    at JDBC_Test.getTableNames(JDBC_Test.java:78)
    at JDBC_Test.jdbc_connect(JDBC_Test.java:44)
    at JDBC_Test.main(JDBC_Test.java:15)
    as you can see it prints the first table name then errors out.
    Any ideas?

  • [ADF Help] How to create a view for multiple tables

    Hi,
    I am using Jdeveloper 11G and ADF framework, and trying to create a view to update multiple tables.
    ex:
    Table A has these fields: ID, Name
    Table B has these fields: ID, Address
    A.ID and B.ID are primary keys.
    B.ID has FK relationship with A.ID
    (basically, these tables have one-to-one relation)
    I want to create a view object, which contains these fields: B.ID (or A.ID), A.Name, B.Address.
    So I can execute C,R,U,D for both tables.
    I create these tables in DB, and create entity objects for these tables.
    So there are 2 entity objects and 1 association.
    Then I create a view object based on B and add fields of A into the view:
    If the association is not a "Composition Association",
    when I run the model ("Oracle Business Component Browser") and try to insert new data, fields of A can't edit.
    If the association is a "Composition Association", and click the insert button, I will get
    "oracle.jbo.InvalidOwnerException: JBO-25030: Failed to find or invalidate owning entity"
    If I create a view object based on A and add filed of B into the view:
    When I run the model and try to insert new data, fields of B can't edit, no matter the association is or is not a composition association.
    So... how can I create a view for multiple tables correctly?
    Thanks for any advices!
    Here are some pictures about my problem, if there is any unclear point, please let me know.
    http://leonjava.blogspot.com/2009_10_01_archive.html
    (A is Prod, B is CpuSocket)
    Edited by: user8093176 on Oct 25, 2009 12:29 AM

    Hi Branislav,
    Thanks, but the result is same ....
    In the step 2 of creating view object, I can select entity objects to be added in to the view.
    If I select A first, and then select B (the "Source Usage" of B is A), then finishing the wizards.
    When I try to create a new record in the view, I can't edit any properties of B (those files are disabled).
    If I select B first, and then select A in crating view object, the result is similar ...
    Thanks for any further suggestion.
    Leon

Maybe you are looking for