Sample coding for multiple table join

Hi,
i need a sample coding for multiple table join. can anyone help me out.
regards
Gokul

SELECT AVBELN AFKDAT AVTWEG ASPART AWAERK AKURRF AKUNAG AKNUMV
         BPOSNR BFKIMG BNETWR BMATNR
         DBEGRU ELABOR E~MATKL
         INTO CORRESPONDING FIELDS OF TABLE ITAB
         FROM VBRK AS A INNER JOIN VBRP AS B
              ON AVBELN EQ BVBELN
         INNER JOIN J_1IEXCHDR AS C
              ON AVBELN EQ CRDOC
         INNER JOIN KNVV AS D
              ON DKUNNR EQ AKUNAG  AND
                 DVKORG EQ AVKORG  AND
                 DSPART EQ ASPART  AND
                 D~BEGRU NE SPACE
         INNER JOIN MARA AS E
              ON EMATNR EQ BMATNR
         WHERE A~FKDAT IN S_FKDAT AND
               A~FKART EQ 'F2'    AND
               A~VTWEG IN S_VTWEG AND
               A~SPART IN S_SPART AND
               A~KUNAG IN S_KUNAG AND
               A~FKSTO NE 'X'     AND
               B~WERKS IN S_WERKS AND
               C~TRNTYP = 'DLFC'  AND
               E~LABOR IN S_LABOR AND
            C~SRGRP IN ('01','02','03','31','32','33','41','42','43',
                        '81','82','83','95','55','45', '48') AND
               B~MATNR IN S_MATNR AND
               D~BEGRU IN S_BEGRU AND
               E~MATKL IN S_MATKL.
but my suggestion not to use more than 2 table in inner join it will affect in performance use for all entries instead of join.
regards
shiba dutta

Similar Messages

  • Plsql coding for multiplication table

    hai i need plsql coding for multiplication table can any one plzzzz.....

    SELECT AVBELN AFKDAT AVTWEG ASPART AWAERK AKURRF AKUNAG AKNUMV
             BPOSNR BFKIMG BNETWR BMATNR
             DBEGRU ELABOR E~MATKL
             INTO CORRESPONDING FIELDS OF TABLE ITAB
             FROM VBRK AS A INNER JOIN VBRP AS B
                  ON AVBELN EQ BVBELN
             INNER JOIN J_1IEXCHDR AS C
                  ON AVBELN EQ CRDOC
             INNER JOIN KNVV AS D
                  ON DKUNNR EQ AKUNAG  AND
                     DVKORG EQ AVKORG  AND
                     DSPART EQ ASPART  AND
                     D~BEGRU NE SPACE
             INNER JOIN MARA AS E
                  ON EMATNR EQ BMATNR
             WHERE A~FKDAT IN S_FKDAT AND
                   A~FKART EQ 'F2'    AND
                   A~VTWEG IN S_VTWEG AND
                   A~SPART IN S_SPART AND
                   A~KUNAG IN S_KUNAG AND
                   A~FKSTO NE 'X'     AND
                   B~WERKS IN S_WERKS AND
                   C~TRNTYP = 'DLFC'  AND
                   E~LABOR IN S_LABOR AND
                C~SRGRP IN ('01','02','03','31','32','33','41','42','43',
                            '81','82','83','95','55','45', '48') AND
                   B~MATNR IN S_MATNR AND
                   D~BEGRU IN S_BEGRU AND
                   E~MATKL IN S_MATKL.
    but my suggestion not to use more than 2 table in inner join it will affect in performance use for all entries instead of join.
    regards
    shiba dutta

  • How to create an explain plan with rowsource statistics for a complex query that include multiple table joins ?

    1. How to create an explain plan with rowsource statistics for a complex query that include multiple table joins ?
    When multiple tables are involved , and the actual number of rows returned is more than what the explain plan tells. How can I find out what change is needed  in the stat plan  ?
    2. Does rowsource statistics gives some kind of  understanding of Extended stats ?

    You can get Row Source Statistics only *after* the SQL has been executed.  An Explain Plan midway cannot give you row source statistics.
    To get row source statistics either set STATISTICS_LEVEL='ALL'  in the session that executes theSQL OR use the Hint "gather_plan_statistics"  in the SQL being executed.
    Then use dbms_xplan.display_cursor
    Hemant K Chitale

  • Context index can't be used in complicated multiple tables join?

    hello
    thank you for view this page.
    i have a comlicated sql :
    SELECT count(*)
    from
    ((app_AssetBasicInfo left join app_AssetBasicInfoExt on
    app_AssetBasicInfo.id=app_AssetBasicInfoExt.id) left join
    (app_AssetCustominfo1 left join app_AssetCustominfoExt1 on
    app_AssetCustominfo1.id=app_AssetCustominfoExt1.id) on
    app_AssetBasicInfo.id=app_AssetCustominfo1.id) WHERE
    app_AssetBasicInfo.CategoryID=1 AND Del_tag=0 and contains(description,'department')>0;
    the table app_AssetBasicInfo and app_AssetBasicInfoExt have multiple columns and large recoord size. i create a context index on app_assetbasicinfoext(description) which description is 4000 varchar2.
    but the sql doesn't use context index. i suspect that the complicated multiple table join can't use context index? does it correct?
    thanks very much!

    Could you please post an explain plan? I'm not quite sure what is the issue.

  • [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

  • 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,

  • 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

  • Required sample coding for invoice billing for script

    Hi,
            Required sample coding for invoice billing for script in form and endform.
         please help me its very urgent issue. thanks in advance.
    thanks&regards
    sirish

    Hi Sirish,
    these are some of the links where u can find ur solution plz check...
    <u>
    SAP SCRIPT
    SAP SCRIPT
    https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=invoicebillingfor+script&adv=false&sortby=cm_rnd_rankvalue</u>
    regards,
    Sana M.

  • Sample coding for creating a function moudle to post the Idoc

    hi,
    I am working on Inbound idoc,
    Aim : to update the Ztable
    I have created the message type , idoc type and the segment type.
    For creating an idoc i have used the Function module IDOC_INBOUND_WRITE_TO_DB.
    Now for posting the idoc, i need to create the function module, the main aim is to insert record to the Ztable, what should be my input and the output parameters,
    Can u provide the sample coding for it

    As you are dealing with a IDOC, the parameters will have to be standard as any other IDOC processing function module. For example take a look at IDOC_INPUT_BANK_CREATE.
    You will have to read the data exactly the way the standard code does and the only change will be once you read the data how do you want to handle the data.
    Regards,
    Ravi
    Note : Please mark all the helpful answers

  • A sample coding for 'MRM_DBTAB_RBKPV_READ'

    i need the sample coding for 'MRM_DBTAB_RBKPV_READ'. i need the coding through which i can reterieve the value.
    Promise to award points.
    Regards,
    Anitha

    report zrich_0003 .
    type-pools: mrm.
    data: xrbkpv type  mrm_rbkpv.
    parameters: p_belnr type rbkp-belnr.
    parameters: p_gjahr type rbkp-gjahr.
    start-of-selection.
      call function 'MRM_DBTAB_RBKPV_READ'
        exporting
          i_belnr               = p_belnr
          i_gjahr               = p_gjahr
    *   I_BUFFER_ON           = 'X'
       importing
          e_rbkpv               = xrbkpv
       exceptions
         entry_not_found       = 1
         others                = 2.
      write:/ xrbkpv-belnr, xrbkpv-gjahr, xrbkpv-blart,
              xrbkpv-bldat, xrbkpv-budat.
    Starting to see a pattern?
    Regards,
    Rich Heilman

  • BAPI coding for CATSDB TABLE i.e Timesheet DB

    BAPI coding for CATSDB TABLE i.e Timesheet DB
    Points will be rewarded,
    Thank you,
    Jagrut BharatKumar Shukla

    Hi Srikhar
    use these bapis
    BAPI_BPCONTACT_CHANGE BAPI
    BAPI_BPCONTACT_CREATEFROMDATA BAPI .... BAPI_CUSTOMERCONTRACT_CHANGE
    BAPI_CTRACCONTRACTACCOUNT_CH1
    reward points to all helpful answers
    kiran.M

  • CacheStore implementation for multiple table

    Hi,
    Is it possible to configure the <cachestore-scheme> element or implement cachestore to get data from multiple
    table. Currently the xml and cachestore sample in the tutorial is configured for single table.
    Thanks
    -thiru

    hello Aleks,
    "As Rob mentioned, you can implement CacheStore to do pretty much anything you want: do a join across multiple tables, execute multiple queries to get data from multiple tables, or even access non-database system, such as a legacy system or a web service in order to retrieve data. Coherence really doesn't care how you implement your cache store and where you get the data from, as long as you return a single object for the load method that needs to be inserted into the cache that the cache store is configured for (or in the case of loadAll, multiple objects in a map)."
    as long as you return a single object for the load method that needs to be inserted into the cache that the cache store is configured for (or in the case of loadAll, multiple objects in a map) -> when you say this.. how can we configure the cache store to be configured for an object?
    I am new to the coherence. Correct me if I am wrong.
    because as I see cache-store will be configure with cache right?
    <cachestore-scheme>
      <class-scheme>
       <class-name>com.company.MyCacheStore</class-name>
          <init-params>
             <init-param>
                <param-type>java.lang.String</param-type>
                <param-value>cache-info</param-value>
             </init-param>
          </init-params>
      </class-scheme>
    </cachestore-scheme>
    Here it is referring to the cache "cache-info" and in the cache "cache-info", I can have Object1 with Key1, Object2 with Key2 and Object3 with Key3, As long as I return any object (object1,object2,object3) it is fine right.
    My cache have 3 objects Object1,Object2 and Object3,
    In cache-store, based on type of the Key I will perform the processing and return the corresponding object. Is it wrong?
    Please comment.
    Thanks in Advance.

  • Need a sample coding for  function module MRM_DBTAG_RSEG_READ

    hi,
    I am working on reports. I was asked to use the function module MRM_DBTAG_RSEG_READ for retrieving the line item information. I tried using the fucntion module, the problem i am facing in the declaration of the internal table I_TE_RSEG for the parameter TE_RSEG.
    It would be better if u provide a sample coding that uses this function module.
    Promise to award points.
    Regards,
    anitha

    Hi,
    you need to declare type-pools mrm. and declare the work area of type mrm_tab_rseg
    check out the code-
    REPORT zzswap .
    TYPE-POOLS mrm.
    DATA: is_te_rseg  TYPE mrm_tab_rseg.
    DATA: w_belnr type RSEG-BELNR,
          w_gjahr type RSEG-GJAHR.
    w_belnr = '1000000004'.
    w_gjahr = '2005'.
    CALL FUNCTION 'MRM_DBTAB_RSEG_READ'
         EXPORTING
              i_belnr         = w_belnr
              i_gjahr         = w_gjahr
              i_buffer_on     = 'x'
         IMPORTING
              te_rseg         = is_te_rseg
         EXCEPTIONS
              entry_not_found = 1
              OTHERS          = 2.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    hope it works.
    Regards,
    Swapnil.

  • Help with multiple table joins

    I'm trying to limit the results of a query joining multiple tables. I have a main table, tbl_webrequests, and multiple tables with supporting information. The unique column for tbl_webrequests is reqID. There is another table, tbl_instructions, that holds all the instructions tied to each request. I join the tables using reqID.
    I'm trying to construct a page that has all of the records in tbl_webrequests. The problem I'm having is that with each request that has multiple instructions, I have multiple results because of the multiple instructions for one reqID. For now, all I want is the original instruction to display. Below is the original query, and below that is what I'm trying to get the query to do for each record in tbl_webrequest. Note that 319 is a random uniqueID in tbl_webrequests.
    SELECT
    DISTINCT W.reqID, W.dt_close, W.dt_due, W.subject, W.statusid, W.empID, W.priorityid, W.assigneeid, W.categoryid, W.url, W.hrs,
    W.closingNotes, W.mins, W.requestTypeID, I.instructions, I.instID
    from tbl_webrequests W left join
    (select reqID, instID, instructions from tbl_instructions) I on W.reqID = I.reqID
    ORDER BY I.instID asc;
    SELECT
    distinct I.instructions, I.instID, W.reqID, W.dt_close, W.dt_due, W.subject, W.statusid, W.empID, W.priorityid, W.assigneeid, W.categoryid, W.url, W.hrs,
    W.closingNotes, W.mins, W.requestTypeID
    from tbl_webrequests W left join
    (select reqID, instID, instructions from tbl_instructions where rowNum = 1 and reqid = 319 order by instID asc) I on W.reqID = I.reqID
    where W.reqID = 319
    ORDER BY I.instID asc;
    My question is, how do I pass the reqID as a variable into the join subquery so that the query returns only returns the first joined item in tbl_instructions for each record in tbl_webrequests?
    Any help is appreciated
    Thanks!

    Scrap the "DISTINCT" and try something like this:
    Select
           I.Instructions, I.Instid
         , W.Reqid, W.Dt_Close, W.Dt_Due, W.Subject, W.Statusid, W.Empid, W.Priorityid
         , W.Assigneeid, W.Categoryid, W.Url, W.Hrs, W.Closingnotes, W.Mins, W.Requesttypeid
      From Tbl_Webrequests W Left Join
         ( Select Reqid, Instid, Instructions
             From Tbl_Instructions I0
            Where Instid = (Select Min(Instid) From Tbl_Instructions I1
                             Where I1.Reqid = I0.Reqid)
         ) I On W.Reqid = I.Reqid
    Where W.Reqid = 319
    Order By I.Instid Asc;;)

  • Single row editing for multiple tables in a single page

    Hi!
    I have split a table with many many columns into more tables with a lower number of columns. There is an ID column (sequence generated) that is Primary Key common for all tables. Obviously, the relationship between these tables is 1 to 1, so it’s not about having to build master-detail pages.
    What I need now is to edit all these tables in a single page: one single row from each table. The Automated Row Fetch & Automatic Row Processing (DML) processes used for the old table must be replaced by something else.
    Is there a way to use in a single page more pairs of such processes for more tables?
    I want to avoid manually writing processes with lot of PL/SQL code to handle row fetch & update.
    Keep in mind that the page will have an ID item that can be used to identify unique rows in all my tables.
    Thanks,
    Sorin

    I have split a table with many many columns into more tables with a lower number of columns
    IMHO that is a very bad idea. There is nothing wrong with having many columns in a table. If you would like to split them to better "categorize" them, just create views on the table and expose different subsets of the columns.
    I want to avoid manually writing processes with lot of PL/SQL code to handle row fetch & update.
    That is unavoidable given how you have designed the underlying tables.
    You could try creating a view that joins all the tables by the PK and creating a form based on that view. Then write a INSTEAD OF trigger on the view that "doles out" the DML on the view to each of the underlying tables.

Maybe you are looking for

  • RFC destination Could not be SPecified for Logical System

    Hello there i am traying to costomize Transaction Luancher for some of the report which is been devloped in ECC (wich is ARD 100) when  on Transaction launcher Wizard--> techincal i am  having a  logical system as ARD100(my r.3 system where report is

  • Dynamic physical table name vs. Cache

    Hello, Experts! I'm facing quite an interesting problem. I have two physical tables with the same structure but with a different data. Requirement is to show same reports with one or another table. Idea is to have dynamically changed physical table n

  • Drag a JLabel, drop in a JList

    I'm trying to implement a drop-and-drag feature in my program. I have a class Book, which extends a JLabel with and ID field (as a string) and a get and set method for the ID in it, as well as a toString method which returns the ID. I need to drag th

  • Class path incomplete at first portal component project

    Hello out there, i have NWDS-SP09 and hav created an Portal-App-Project. There i created a new portal-component (JSPDynPage). The generated class looks as following: package com.kpmg.portaldev.jspdynpages; import com.sapportals.portal.prt.component.*

  • Using JCheckBox, JButton and JTextArea with JDBC

    Hello shlumph and SoulTech2012. thanks for the reply. I�m wondering do any of you have links to web pages that include tutorials and source code on using JCheckBox, JButton and JTextArea with JDBC. would any of you who have experience with using JChe