Using a Value index on XMLIndex path table.

I am trying to understand how to capitalize on the VALUE index created on a XMLIndex path table. So far, I have not been able to successfully use it. I am not sure whether I am misunderstanding the way it is intended to be used? Or am making a mistake somewhere else along the way. Here is a use-case where I think that it should be getting picked up by the optimizer:
CREATE TABLE TEST_TABLE
    (ID VARCHAR2(128) NOT NULL,
    XML_DATA XMLTYPE NOT NULL,
    CONSTRAINT TEST_PK PRIMARY KEY (ID))
XMLTYPE COLUMN XML_DATA STORE AS BINARY XML;
-- Populate the table with some random data.  Here, our single attribute should be
-- unique for each row.
INSERT INTO TEST_TABLE (
  SELECT dbms_random.string('A', 15), XMLElement("Test", XMLAttributes(dbms_random.string('A', 15) as "someAttr"))
  FROM DUAL
  CONNECT BY LEVEL <= 20000 );
CREATE INDEX test_xmlindex_ix ON TEST_TABLE(XML_DATA) INDEXTYPE IS XDB.XMLIndex
  PARAMETERS('
    PATHS (Include (/Test/@someAttr))
    PATH TABLE      test_path_table
    PATH ID INDEX   test_path_id_ix
    ORDER KEY INDEX test_key_ix
    VALUE INDEX     test_value_ix ');
-- Not sure if I need these or not?
CALL DBMS_STATS.GATHER_TABLE_STATS ('MYSCHEMA', 'TEST_TABLE');
CALL DBMS_STATS.GATHER_TABLE_STATS ('MYSCHEMA, 'TEST_PATH_TABLE');
-- Now, I would expect this query to use the Value index that was created.
-- Instead, the Explain plan indicates that TEST_PATH_ID_IX was used..
SELECT xml_data
FROM   test_table v
WHERE  extractValue(v.xml_data, '/Test/@someAttr') = ?
Here are the operations listed in the explain plan for the query:
SELECT STATEMENT
FILTER
TABLE ACCESS(FULL) MYSCHEMA.TEST_TABLE
TABLE ACCESS(BY INDEX ROWID) MYSCHEMA.TEST_PATH_TABLE
INDEX(RANGE SCAN) MYSCHEMA.TEST_PATH_ID_IXIf I understand everything correctly, here, there is no reason why the PATH ID index should have been used. Isn't this index strictly for the XML tags themselves? Why wouldn't it use the Value index?
Thanks,
Jon

PATH_TABLE
+=======================================================+
| PathID |  RID  | Order_Key | Locator |     Value      |
|-------------------------------------------------------|
|  RAW   | rowid |    RAW    |   RAW   | varchar2(4000) |
|-------------------------------------------------------|
|        |       |           |         |                |
|        |       |           |         |                |
|        |       |           |         |                |
|        |       |           |         |                |
|        |       |           |         |                |
|        |       |           |         |                |
|        |       |           |         |                |
+=======================================================+
XMLIndex
1) PATH  INDEX: (PathID, RID)              - BTree
2) ORDER INDEX: (RID, ORDER_KEY)           - BTree
3) VALUE INDEX: (substr("VALUE",1,1599))   - Function Based
Locator: Pointer to XML Fragments
XMLIndex - Namespace issue...
I believe that (although I don't know the exact mechanics) that it will use the path index first to find the needed
tree node / path, then will look for a locator that matches the request and if not will do an full table scan
afterwards, if not successful, trying to limit the request with the filter at hand, so see if it can be used, to
minimize the sub-results.
Message was edited by:
Marco Gralike

Similar Messages

  • Need help in using a Secondary Index of a GL Table

    Hello ABAPers,
    Good morning/afternoon!
    I  was wondering if anyone could give me a hand on this issue.
    To give you a brief background, I need to retrieve Open and Cleared items in the last 24 hours, that is, from 11 am yesterday till 10:59:59 today. The criteria is to pull the information using Entry Date (CPUDT) and Entry Time (CPUTM) from BKPF and using BELNR, retrieve the postings in BSIS and BSAS. as you can see in the piece of code. However, this process takes soooooo long to run.
    Below is the code snippet.
    We use 46C and MS SQL database.
    The index fields of BKPF~ZB2 are: MANDT, CPUDT and BLART.
    The index fields of BSIS~Z01are: BUKRS, GJAHr, HKONT, PRCTR, GSBER
    TYPES: BEGIN OF i_bseg,
           bukrs LIKE bkpf-bukrs,
           hkont LIKE bsis-hkont,
           gjahr LIKE bkpf-gjahr,
           belnr LIKE bkpf-belnr,
           buzei LIKE bsis-buzei,
           bldat LIKE bsis-bldat,
           budat LIKE bsis-budat,
           waers LIKE bsis-waers,
           monat LIKE bsis-monat,
           shkzg LIKE bsis-shkzg,
           gsber LIKE bsis-gsber,
           dmbtr LIKE bsis-dmbtr,
           wrbtr LIKE bsis-wrbtr,
           cpudt LIKE bkpf-cpudt,
           cputm LIKE bkpf-cputm,
           END OF i_bseg.
    *Internal Tables
    DATA:
          i_bkpf TYPE TABLE OF bkpf,
          i_bseg TYPE STANDARD TABLE OF i_bseg.
    Select records from yesterday's entry date.
        SELECT  bukrs belnr gjahr monat budat cpudt cputm waers
                FROM bkpf INTO  CORRESPONDING FIELDS OF TABLE i_bkpf
                WHERE ( cpudt = so_date2-low AND
                        cputm >= so_cputm-low AND
                        cputm <= so_cputm-high )
                OR    ( cpudt = so_date2-high AND
                        cputm >= so_time2-low AND
                        cputm <= so_time2-high )
                %_HINTS MSSQLNT 'INDEX("BKPF" "BKPF~ZB2")'.
        IF sy-subrc NE 0.
          MESSAGE e006 WITH 'BKPF'.
        ENDIF.
    Select Open Items***
        SELECT bukrs hkont gjahr belnr buzei  budat bldat
               waers monat shkzg gsber  dmbtr wrbtr
               FROM bsis
               APPENDING CORRESPONDING FIELDS OF TABLE i_bseg
               FOR ALL ENTRIES IN i_bkpf
               WHERE bukrs = i_bkpf-bukrs
               AND gjahr = i_bkpf-gjahr
               AND hkont IN so_saknr
               AND belnr = i_bkpf-belnr
               %_HINTS MSSQLNT 'INDEX("BSIS" "BSIS~Z01")'.
    Also get any cleared items ***
        SELECT bukrs hkont gjahr belnr buzei  budat bldat
               waers monat shkzg gsber  dmbtr wrbtr
               FROM bsas
               APPENDING CORRESPONDING FIELDS OF TABLE i_bseg
               FOR ALL ENTRIES IN i_bkpf
               WHERE bukrs IN so_bukrs
               AND   hkont IN so_saknr
               AND   gjahr = sp_gjahr
               AND   belnr = i_bkpf-belnr.
    Many thanks,
    Rosemarie

    Thanks for your response.
    The date and time fields are defined in my selection screen and the default values pre-set in the INITIALIZATION, so the dates and times are already stored as a range.
    The problem is why is the process taking so long. Is the syntax for the INDEX correct?
    PARAMETERS:p_not RADIOBUTTON GROUP pass.
    SELECT-OPTIONS:
      so_date2 FOR bkpf-cpudt,         " Entry Date
      so_cputm FOR sy-uzeit,         " Entry Time
      so_time2 for sy-uzeit.        " Entry Time 2
    INITIALIZATION.
    RANGES: so_time2 FOR sy-uzeit.
      g_date = sy-datum - 1.
      g_year = sy-datum+0(4).
      sp_gjahr = g_year.
      CONCATENATE sp_gjahr '0101' INTO g_from_date.
      g_from_time = '110000'.
      g_24_hour   = '235959'.
      g_time_diff = g_24_hour - g_from_time.
      g_to_time = g_from_time + g_time_diff.
      g_to_time2 = g_from_time - 1.
      MOVE: 'I'      TO so_cpudt-sign,
            'BT'     TO so_cpudt-option,
            g_from_date   TO so_cpudt-low,
            sy-datum TO so_cpudt-high.
      APPEND so_cpudt.
      MOVE: 'I'      TO so_date2-sign,
            'BT'     TO so_date2-option,
            g_date   TO so_date2-low,
            sy-datum TO so_date2-high.
      APPEND so_date2.
      MOVE: 'I'         TO so_cputm-sign,
            'BT'        TO so_cputm-option,
            g_from_time TO so_cputm-low,
            g_to_time   TO so_cputm-high.
      APPEND so_cputm.
      MOVE: 'I'         TO so_time2-sign,
            'BT'        TO so_time2-option,
            '000000'    TO so_time2-low,
             g_to_time2 TO so_time2-high.
      APPEND so_time2.

  • How do I program the use of Z index on a database table

    Hello friends,
    I need an example of an ABAP  program where the use of a customer defined index (, i.e. Z**) on a DB table is forced.
    I do not want to use primary index. I've created an index and I want to use / force my own index in the program.
    Any ideas please?
    Thanks for your help.

    Hi,
    As per my knowledge Nothing to specify as secondary index in program.
    Regards
    Md.MaahboobKhan

  • XMLIndex: finding indexed XPaths and the number of rows in the path table

    Hi,
    I am storing non-schema-based binary XMLs in an XMLType column in 11g (11.1.0.6.0) and would like to index the XMLs either partially or fully using XMLIndex. I'm expecting to have a large number (tens of millions) of XML documents and have some concerns about the size of the XMLIndex path table.
    In short, I am worried that the path table might grow unmanageable large. In order to avoid this and to plan for table partitioning, I would like to create a report of all indexed XPaths in an XMLIndex and to find out how many times each path is actualized in the path table. I would do this for a representative XML sample.
    I have been creating XMLIndexes with different exclude/include paths, gathering stats with DBMS_STATS (estimate_percent = 100) and selecting the number of rows in the path table through USER_TABLES.
    If anyone knows a more straightforward way of doing this all advice is very much appreciated.
    Best Regards,
    Rasko Leinonen

    Thanks Marco,
    I managed to get out all indexed paths using the following SQL. It took a while to understand how the join the XDB.X$PT39CW6BJR8W4VVE0G0LLGA0OCR5 and XDB.X$QN39CW6BJR8W4VVE0G0LLGA0OCR5 tables together but got there in the end. This helps to clarify which XPaths are being currently indexed by the XMLIndex.
    begin
    for v_row in (select PATH from XDB.X$PT39CW6BJR8W4VVE0G0LLGA0OCR5)
    loop
    declare
    v_i BINARY_INTEGER := 1;
    v_id raw(8);
    v_len BINARY_INTEGER := 2;
    v_skip BINARY_INTEGER := 1;
    begin
    while v_i < utl_raw.length(v_row.path) and
    v_i + v_len <= utl_raw.length(v_row.path)
    loop
    v_i := v_i + v_skip;
    v_id := utl_raw.substr(v_row.path, v_i, v_len);
    --dbms_output.put_line(v_id);
    for v_row2 in (select LOCALNAME, flags from XDB.X$QN39CW6BJR8W4VVE0G0LLGA0OCR5
    where ID = v_id )
    loop
    if rawtohex(v_row2.flags) = '01'
    then
    dbms_output.put('@');
    end if;
    dbms_output.put(v_row2.localname);
    if v_i + v_len < utl_raw.length(v_row.path)
    then
    dbms_output.put('/');
    end if;
    end loop;
    v_i := v_i + v_len;
    end loop;
    dbms_output.put_line('');
    end;
    end loop;
    end;
    Example output:
    RUN
    RUN/@accession
    RUN/@alias
    RUN/@instrument_model
    RUN/@run_date
    RUN/@run_center
    RUN/@total_data_blocks
    RUN/EXPERIMENT_REF
    RUN/EXPERIMENT_REF/@accession
    RUN/EXPERIMENT_REF/@refname
    RUN/DATA_BLOCK
    RUN/DATA_BLOCK/@name
    RUN/DATA_BLOCK/@total_spots
    RUN/DATA_BLOCK/@total_reads
    RUN/DATA_BLOCK/@number_channels
    RUN/DATA_BLOCK/@format_code
    RUN/DATA_BLOCK/@sector
    RUN/DATA_BLOCK/FILES
    RUN/DATA_BLOCK/FILES/FILE
    RUN/DATA_BLOCK/FILES/FILE/@filename
    RUN/DATA_BLOCK/FILES/FILE/@filetype
    RUN/RUN_ATTRIBUTES
    RUN/RUN_ATTRIBUTES/RUN_ATTRIBUTE
    RUN/RUN_ATTRIBUTES/RUN_ATTRIBUTE/TAG
    RUN/RUN_ATTRIBUTES/RUN_ATTRIBUTE/VALUE

  • XMLIndex Value Index on repository

    Hello,
    I'm still fighting with that peculiar "value index" feature. Unfortunately I cannot really find comprehensive in-depth information on it at all.
    Has anyone ever gotten this to work with the repository?
    What I have found out so far:
    1) When you have an normal table with an XMLType column and an XMLIndex on this column, then the only way to make VALUEIX show up in the EXPLAIN plan is when I write sth. like this:
    SELECT rowid FROM exampletable WHERE EXISTSNODE(xmlcolumn,'/xml[leaf="green"]')=1;
    2) It does NOT work if I write:
    SELECT rowid FROM exampletable WHERE EXTRACTVALUE(xmlcolumn,'/xml/leaf')='green';
    For some reason Oracle isn't able to detect it can use the VALUE index in the latter case.
    Only PATHIX is used.
    3) The type seems to be important. It does NOT work either if I write:
    SELECT rowid FROM exampletable WHERE EXISTSNODE(xmlcolumn,'/xml[leaf=green]')=1;
    That's OK, though. According to the documentation the value index created by default is for strings only.
    4) Now, with the repository, the first thing to note is that you MUST use UNDER_PATH in your query to limit results on the folders you have created an XMLIndex on.
    SELECT rowid FROM resource_view
    WHERE
    EXTRACTVALUE(res,'/r:Resource/r:Contents/xml/leaf,'xmlns:r="http://xmlns.oracle.com/xdb/XDBResource.xsd"')='green'
    AND UNDER_PATH(res,'/public')=1
    This uses only PATHIX, though. This follows the logic from above which is that EXTRACTVALUE never uses a VALUE index.
    5) OK. Let's try EXISTSNODE then:
    SELECT rowid FROM resource_view
    WHERE
    EXTRACTVALUE(res,'/r:Resource/r:Contents/xml[leaf="green"],'xmlns:r="http://xmlns.oracle.com/xdb/XDBResource.xsd"')=1
    AND UNDER_PATH(res,'/public')=1
    This doesnt use any xml index at all :-(
    Why?

    I've tried all variants over the last hours to no avail.
    Interestingly, Example 5-31 here is nearly the same query I'm doing:
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28369/xdb_indexing.htm#CHDBGBEG
    Unfortunately, they don't give an EXPLAIN plan with that query so I don't know what they think should happen.
    Can the VALUE INDEX be used at all with a repository? My case is the simplest one I could think of. My steps:
    1) Take any XML DB repository
    2) Insert an XML file (for instance with WebDAV, doesnt matter though)
    3) Create an XMLIndex with CALL DBMS_XDB_ADMIN.CreateRepositoryXMLIndex(); and DBMS_XDB_ADMIN.XMLIndexAddPath(...)
    4) Try to make a simple XMLExists() query
    Doesnt work. No VALUE INDEX used. :-(
    Is there any way to query the VALUE INDEX of a repository manually in case this is an Oracle bug? I somehow need to make this work,
    because the repository is pretty useless otherwise if I can't query it in an efficient manner.

  • How to prevent Oracle from using an index when joining two tables ...

    How to prevent Oracle from using an index when joining two tables to get an inline view which is used in an update statement?
    O.K. I think I have to explain what I mean:
    When joining two tables which have many entries sometimes it es better not to use an index on the column used as join criteria.
    I have two tables: table A and table B.
    Table A has 4.000.000 entries and table B has 700.000 entries.
    I have a join of both tables with a numeric column as join criteria.
    There is an index on this column in table A.
    So I instead of
      where (A.col = B.col)I want to use
      where (A.col+0 = B.col)in order to prevent Oracle from using the index.
    When I use the join in a select statement it works.
    But when I use the join as inline view in an update statement I get the error ORA-01779.
    When I remove the "+0" the update statement works. (The column col is unique in table B).
    Any ideas why this happens?
    Thank you very much in advance for any help.
    Regards Hartmut

    I think you should post an properly formatted explain plan output using DBMS_XPLAN.DISPLAY including the "Predicate Information" section below the plan to provide more details regarding your query resp. update statement. Please use the \[code\] and \[code\] tags to enhance readability of the output provided:
    In SQL*Plus:
    SET LINESIZE 130
    EXPLAIN PLAN FOR <your statement>;
    SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);Usually if you're using the CBO (cost based optimizer) and have reasonable statistics gathered on the database objects used the optimizer should be able to determine if it is better to use the existing index or not.
    Things look different if you don't have statistics, you have outdated/wrong statistics or deliberately still use the RBO (rule based optimizer). In this case you would have to use other means to prevent the index usage, the most obvious would be the already mentioned NO_INDEX or FULL hint.
    But I strongly recommend to check in first place why the optimizer apparently seems to choose an inappropriate index access path.
    Regards,
    Randolf
    Oracle related stuff:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle:
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • Can I use MD5 value for indexing files ?

    I would like to know if MD5 value for each unqiue file is also unique. I am wonder if U can use MD5 value of a file for indexing. Any suggestion ??

    I would like to know if MD5 value for each unqiue file
    is also unique.No, since the number of MD5 hashes is less than the number of possible files. Of course, if you don't have many files the probability of clashes is pretty low. There's some theory about this which you'll find in algorithms textbooks where they talk about hash tables.
    I am wonder if U can use MD5 value of
    a file for indexing. Any suggestion ??Why? Don't you want your index to tell you something about the contents of the file?

  • Read Table ITAB with key Dynamic Value index 1

    Here is sample Intenral table
    Columnname-C01 / C02 / C03
    Value-123 / 456 /789
    I would like to search value of the internal table according to dynamic value given by the code.
    i.e.
    read table ITAB with key <Dynamic Value> index 1.

    Hi,
    Apart from read, you can also use <b>SEARCH</b> statement.
    Syntax
    SEARCH
    Searches for strings.
    Syntax
    SEARCH <f>|<itab> FOR <g> [ABBREVIATED]
                              [STARTING AT <n1>]
                              [ENDING AT <n2>]
                              [AND MARK]
                              [IN BYTE MODE|IN CHARACTER MODE].
    Searches the field <f> or table <itab> for the string in the field <g>. The result is stored in SY-FDPOS. The additions let you hide intermediate characters, search from and to a particular position, and convert the found string into uppercase. In Unicode programs, you must specify whether the statement is a character or byte operation, using the IN BYTE MODE or IN CHARACTER MODE (default) additions.
    Hope this information is useful to you.
    Regards,
    Saumya

  • SSIS-How to pass multiple value to stored procedure from table row one by one using ssis package??

    I want to execute a stored procedure using ssis.But the problem  I am having is that there is a table with 200 rows with only
    single column.Now i want to execute stored procedure using value one by one from table .once the stored procedure is executed with top value from table i also want to delete that topmost column value and execute with next table value.and store the result in
    text file.
    please help me..or provide a package.

    If you want to do it in SSIS, a way to do this is by using For Each Loop as mentioned above.
    Create 1 OBJECT type variable (list of values) and one STRING type variable (one value at a time)
    Use EXE SQL Task with ResultSet = FULL RESULT SET and query = SELECT COL FROM TABLE ORDER BY COL ASC...output this to the OBJECT type variable 
    Next, a For Each loop container with Foreach ADO Enumerator, ADO object source variable = Object type variable and map that to String type variable with index = 0.
    Within your for each loop container, select another EXEC SQL Task and pass in an input parameter (the String type variable) and query = EXEC PROC ? -- WHERE ? = String type variable.
    This will execute your store procedure just for that one value out of the whole list.
    Now within the same For Each loop, select another EXEC SQL Task and again pass in an input parameter (the same String type variable) and query = DELETE FROM TABLE WHERE COL = ? -- WHERE ? = the current value 
    The above process should A) get the list of values from the table B) pick one value at a time and execute the proc and delete and right after delete that value from the table.
    Hope this helps.
    -- some further investigation/tweaking may require but it should help you get started.

  • How to use simple values services for multiple rows ina table

    Hi Frnds...
    As per my requirment i need to use SVS for multile rows in a table.
    The coding goes like this for getting single attribute which is directly under root context.
    objSimpleValueSetCurr = wdContext.getNodeInfo().getAttribute("ctx_attribute");
    (this is only for context attribute directly placed under root context in the view controller.)
    We need to use value node and a value attribute inside this node. And retrieve the same. so need help regarding the code changes.
    Regards,
    Sudeep

    Hi ,
    I had tried out your suggestion. Its not working.
    The code goes like this, but the data is not getting populated.
    "controller_curr" is the value attribute  under the node "InitTable" in the controller which is further mapped to view controller with the same structure.
    The data is geting printed through the message manager just before the line
    divSMT.put(currency,currency); in this code, at the end.
    But "divSMT.put" is not able to populate the data.
    _________START________
    public void currency( )
        //@@begin currency()
              IWDMessageManager msg = wdComponentAPI.getMessageManager();     
              ISimpleTypeModifiable objSimpleTypeCurr = null;
              IModifiableSimpleValueSet objSimpleValueSetCurr = null;
              String currency=null;
              String bandg = null;
              Z_Bapi_Get_Curr_Rate_Input authCurrDet = null; //for FCURR
        Try
    authCurrDet = new Z_Bapi_Get_Curr_Rate_Input();
                         wdContext.nodeZ_Bapi_Get_Curr_Rate_Input().bind(authCurrDet);
                              wdContext.nodeZ_Bapi_Get_Curr_Rate_Input().currentZ_Bapi_Get_Curr_Rate_InputElement().modelObject().execute();     
    IWDAttributeInfo  objSimpleValueSetCurr1 = wdContext.nodeInitTable().getNodeInfo().getAttribute("controller_curr");
    ISimpleTypeModifiable countryType = objSimpleValueSetCurr1.getModifiableSimpleType();
    IModifiableSimpleValueSet divSMT = countryType.getSVServices().getModifiableSimpleValueSet();
    int sizeofCurrencyFCURR = wdContext.nodeOPCURROutput().nodeIt_Curr_Rate().size();
    msg.reportSuccess("SizeofCurrency FCURR : "+sizeofCurrencyFCURR);
    for(int i=0;i<sizeofCurrencyFCURR;i++)
    currency = wdContext.nodeOPCURROutput().nodeIt_Curr_Rate().getIt_Curr_RateElementAt(i).getFcurr();
    msg.reportSuccess("Currency : "+currency);
    divSMT.put(currency,currency);
         catch(Exception e)
    //@@end
    _________END________
    Please look into the issue.
    Regards.

  • Update table a columns using columns from table b (values of 2 columns of table b need to taken from table c)

    Guys,
    I need to update table A columns col3, col4, col5 and col6 by table b columns col3, col4, col5 and col6 however table b col5 and col6 values need to come from table c col1.
    Means table b col5 and col6 have values in it however i need to replace them with value from table c col1 and need to update table a col5 and col6 accordingly.
    table a and table b has col1 and col2 in common.
    i am trying something like this.
    Update a
    a.col3 = b.col3,
    a.col4 = b.col4,
    a.col5 = (select col1 from table_c c where c.col2=b.col5),
    a.col6 = (select col1 from table_c c where c.col2=b.col6)
    from table_A a inner join table_b
    on  a.col1=b.col1 and a.col2=b.col2
    can someone help me reframe above update query?
    thanks in advance for your help.

    Try the below:(If you have multiple values, then you may need to use TOP 1 as commented code in the below script)
    create Table tableA(Col1 int,Col2 int,Col3 int,Col4 int,Col5 int,Col6 int)
    Insert into tableA values(1,2,3,4,5,6)
    create Table tableB(Col1 int,Col2 int,Col3 int,Col4 int,Col5 int,Col6 int)
    Insert into tableB values(1,2,30,40,50,60)
    create Table tableC(Col1 int,Col2 int,Col3 int,Col4 int,Col5 int,Col6 int)
    Insert into tableC values(100,50,30,40,2,2)
    --Insert into tableC values(200,50,30,40,2,2)
    Insert into tableC values(100,60,30,40,2,2)
    Select * From tablea
    Update a Set
    a.col3 = b.col3,
    a.col4 = b.col4,
    a.col5 = (select col1 from tablec c where c.col2=b.col5 ),
    a.col6 = (select col1 from tablec c where c.col2=b.col6 )
    from tableA a inner join tableb b
    on a.col1=b.col1 and a.col2=b.col2
    --Update a Set
    --a.col3 = b.col3,
    --a.col4 = b.col4,
    --a.col5 = (select Top 1 col1 from tablec c where c.col2=b.col5 Order by c.Col1 asc),
    --a.col6 = (select Top 1 col1 from tablec c where c.col2=b.col6 Order by c.Col1 asc)
    --from tableA a inner join tableb b
    --on a.col1=b.col1 and a.col2=b.col2
    Select * From tablea
    Drop table tablea,Tableb,TableC

  • How to use a value taken in a variable as a table name in a query?

    I am fetching a value in a variable as:
    <select application_short_name into l_appl_nm from fnd_application where application_id=:p_appl_id>
    Now I need to use the value fetched in variable "l_appl_nm" as a table partition name in next query.
    Can anyone please guide me on this concept.
    Expecting replies asap !!

    I am fetching a value in a variable as:
    <select application_short_name into l_appl_nm from fnd_application where application_id=:p_appl_id>
    Now I need to use the value fetched in variable "l_appl_nm" as a table partition name in next query.
    Wrong.
    This is NOT how partition pruning should be applied.
    Expecting replies asap !!
    In that case, the forum members who provide their experience and knowledge for free, expects you to PAY for that.
    You want make demands on this volunteer forum? Then by the same token, payment demands can be made on you.
    So.. are you going to pay up?

  • Using Characteristic value with Replacement path variable

    Hi All,
    Could you please let me know if it is possible to use charecteristic value instead of key figure with replacement path variable. My requirement is to use factory calendar id as the replacement variable on plant characteristic, now when I choose replcaement variable with Attribute value, the dropdown menu only gives the list of key figures assigned as an attributes to Plant.
    Now I am looking for a solution to use factory calendar id as the attribute.
    Thanks for your help in advance.
    Regards
    SS

    Hi sachin
    U can use it
    Look at these links
    Re: Customer exit &  Replacement path........?
    Variable with Replacement Path
    Re: Replacement Path for Charastrictics Variable
    http://help.sap.com/saphelp_nw04/helpdata/en/03/6ba03cc24efd1de10000000a114084/frameset.htm
    Regards
    KR

  • Using column value is it possible to find the table name in the database?

    Hi all,
    using column value is it possible to find the table name in the database?
    guys i need the table value
    Note:
    oracle-9i
    for example:
    i don't know NIC(column value) in which table in the database.
    Thank you,
    with regards,
    JP.
    Edited by: Guest on Feb 27, 2012 5:42 AM

    Hi,
    As far as I understand what you are asking for I would suggest 4 data dictionaries that will help you to know the table name from the column names
    1. USER_TAB_COLS
    2. ALL_TAB_COLS
    3. DBA_TAB_COLS
    4. COLS
    These can give you detail information about the columns and respective tables at user, schema, dba level. Further information on the table can be found by querying ALL_OBJECTS table giving table_name as Object_name, or you can join the data dictionaries too.
    To know about various data dictionaries avalible in Oracle please query select * from cat;
    Let us know if you need further assistance.
    Twinkle

  • Problem in accessing mseg table using MSEG~M Index.

    Hi Experts,
    I am facing problem in accessing mseg table using MSEG~M Index. I used same sequence of fields and i tried with mandt field also. but it is not taking the Index and it is going for TImeout ABAP dump.
    This are my codes used in different ways
    1.  SELECT  mjahr
             bwart
             matnr
             lifnr
             dmbtr
             kostl
             aufnr
             bukrs
             FROM mseg CLIENT SPECIFIED INTO TABLE t_mseg2
                      WHERE mandt EQ sy-mandt      AND
                            matnr NE SPACE         AND
                            werks EQ p_werks       AND
                            lgort NE '0000'        AND
                            bwart IN (122,201,262) AND
                            sobkz NE '0'
                            %_HINTS ORACLE 'INDEX("MSEG" "MSEG~M")'.
    2.   SELECT  mjahr
             bwart
             matnr
             lifnr
             dmbtr
             kostl
             aufnr
             bukrs
             FROM mseg  INTO TABLE t_mseg2
                      WHERE matnr NE SPACE         AND
                            werks EQ p_werks       AND
                            lgort NE '0000'        AND
                            bwart IN (122,201,262) AND
                            sobkz NE '0'
                            %_HINTS ORACLE 'INDEX("MSEG" "MSEG~M")'.
    3.   SELECT  mjahr
             bwart
             matnr
             lifnr
             dmbtr
             kostl
             aufnr
             bukrs
             FROM mseg INTO TABLE t_mseg2
                      WHERE matnr NE SPACE         AND
                            werks EQ p_werks       AND
                            lgort NE '0000'        AND
                            bwart IN (122,201,262) AND
                            sobkz NE '0'.                   
    The above all code is not at all taking the index in Quality server .but in Development it is taking .In Quality server it is reading all datas without using the index and going Timeout ABAP dmup
    Please, Suggest me some solutions.
    Thanks in Advance.
    Regards,
    Nandha

    Hi,
    Without NE also not working out. i am facing same problem still.
    SELECT  bwart
             matnr
             lifnr
             dmbtr
             kostl
             aufnr
             FROM mseg CLIENT SPECIFIED INTO TABLE t_mseg
                      WHERE mandt EQ sy-mandt      AND
                            werks EQ p_werks       AND
                            bwart IN (122,201,262) AND
                            mjahr EQ p_year        AND
                            bukrs EQ p_cc
                            %_HINTS ORACLE 'INDEX("MSEG" "MSEG~M")'.
    Please,check and help me out from this issue.
    Regards,
    Nandha

Maybe you are looking for

  • How do I see 3rd subscription on iCAL?

    I have us holidays, birthdays now I want to add Jewish holiday calendar. I did subcribe but cannot see it on calendar.

  • For sel. field 'PERNR', no selection with SIGN = 'I'; OPTION ' ' allowed

    HI, I am getting this error when i m wrintg this routine. data: l_idx like sy-tabix. read table l_t_range with key      fieldname = 'PERNR'.           l_idx = sy-tabix.           L_T_RANGE-IOBJNM   =      '0EMPLOYEE'.           L_T_RANGE-FIELDNAME  =

  • Making search non case sensitive

    Hi, I have implemented a search help which I have copied from standard help 'PREM'. I have created a Database view, taking that View I have created an Elementary search help and I have assign the elementary search help in the collective search help '

  • How to Handling XML footnote which have attributes

    Hi all, I searched in this forum related to XML footnote discussion. Still I need more clarification/discussion related to this process. I need maximum input and suggestion related to this topic to streamline our process. Our projects have around min

  • How does one open something in a new window rather than a new tab, when browsing?

    I much prefer how this used to be before I upgraded to the latest iOS, in this sense. I do not like dealing with multiple tabs; there are times that a new window is just needed. I am assuming that it is possible to open new windows and I just haven't