Joins And For all Enteries in Select Statement

Could you please tell me when there is a high amount of data which is being handled in the table, does the use of INNER JOINS and FOR ALL ENTERIES in SELECT Statement decreases the system performance? ?
Can you also let me know where can i get some tips regarding do's and dont's for ABAP Programming, I want to increase my system performance.
Currently the programs which are being used are taking a lot of time for execution...
Its very URGENT!

Hai Jyotsna
Go through the following Tips for improving Performence
For all entries
The for all entries creates a where clause, where all the entries in the driver table are combined with OR. If the number of entries in the driver table is larger than rsdb/max_blocking_factor, several similar SQL statements are executed to limit the length of the WHERE clause.
The plus
Large amount of data
Mixing processing and reading of data
Fast internal reprocessing of data
Fast
The Minus
Difficult to program/understand
Memory could be critical (use FREE or PACKAGE size)
Some steps that might make FOR ALL ENTRIES more efficient:
Removing duplicates from the driver table
Sorting the driver table
If possible, convert the data in the driver table to ranges so a BETWEEN statement is used instead of and OR statement:
               FOR ALL ENTRIES IN i_tab
                  WHERE mykey >= i_tab-low and
             mykey <= i_tab-high.
Nested selects
The plus:
Small amount of data
Mixing processing and reading of data
Easy to code - and understand
The minus:
Large amount of data
when mixed processing isn’t needed
Performance killer no. 1
Select using JOINS
The plus
Very large amount of data
Similar to Nested selects - when the accesses are planned by the programmer
In some cases the fastest
Not so memory critical
The minus
Very difficult to program/understand
Mixing processing and reading of data not possible
Use the selection criteria
SELECT * FROM SBOOK.                   
  CHECK: SBOOK-CARRID = 'LH' AND       
                  SBOOK-CONNID = '0400'.        
ENDSELECT.                             
SELECT * FROM SBOOK                     
  WHERE CARRID = 'LH' AND               
        CONNID = '0400'.                
ENDSELECT.                              
Use the aggregated functions
C4A = '000'.              
SELECT * FROM T100        
  WHERE SPRSL = 'D' AND   
        ARBGB = '00'.     
  CHECK: T100-MSGNR > C4A.
  C4A = T100-MSGNR.       
ENDSELECT.                
SELECT MAX( MSGNR ) FROM T100 INTO C4A 
WHERE SPRSL = 'D' AND                
       ARBGB = '00'.                  
Select with view
SELECT * FROM DD01L                    
  WHERE DOMNAME LIKE 'CHAR%'           
        AND AS4LOCAL = 'A'.            
  SELECT SINGLE * FROM DD01T           
    WHERE   DOMNAME    = DD01L-DOMNAME 
        AND AS4LOCAL   = 'A'           
        AND AS4VERS    = DD01L-AS4VERS 
        AND DDLANGUAGE = SY-LANGU.     
ENDSELECT.                             
SELECT * FROM DD01V                    
WHERE DOMNAME LIKE 'CHAR%'           
       AND DDLANGUAGE = SY-LANGU.     
ENDSELECT.                             
Select with index support
SELECT * FROM T100            
WHERE     ARBGB = '00'      
       AND MSGNR = '999'.    
ENDSELECT.                    
SELECT * FROM T002.             
  SELECT * FROM T100            
    WHERE     SPRSL = T002-SPRAS
          AND ARBGB = '00'      
          AND MSGNR = '999'.    
  ENDSELECT.                    
ENDSELECT.                      
Select … Into table
REFRESH X006.                 
SELECT * FROM T006 INTO X006. 
  APPEND X006.                
ENDSELECT
SELECT * FROM T006 INTO TABLE X006.
Select with selection list
SELECT * FROM DD01L              
  WHERE DOMNAME LIKE 'CHAR%'     
        AND AS4LOCAL = 'A'.      
ENDSELECT
SELECT DOMNAME FROM DD01L    
INTO DD01L-DOMNAME         
WHERE DOMNAME LIKE 'CHAR%' 
       AND AS4LOCAL = 'A'.  
ENDSELECT
Key access to multiple lines
LOOP AT TAB.          
CHECK TAB-K = KVAL. 
ENDLOOP.              
LOOP AT TAB WHERE K = KVAL.     
ENDLOOP.                        
Copying internal tables
REFRESH TAB_DEST.              
LOOP AT TAB_SRC INTO TAB_DEST. 
  APPEND TAB_DEST.             
ENDLOOP.                       
TAB_DEST[] = TAB_SRC[].
Modifying a set of lines
LOOP AT TAB.             
  IF TAB-FLAG IS INITIAL.
    TAB-FLAG = 'X'.      
  ENDIF.                 
  MODIFY TAB.            
ENDLOOP.                 
TAB-FLAG = 'X'.                  
MODIFY TAB TRANSPORTING FLAG     
           WHERE FLAG IS INITIAL.
Deleting a sequence of lines
DO 101 TIMES.               
  DELETE TAB_DEST INDEX 450.
ENDDO.                      
DELETE TAB_DEST FROM 450 TO 550.
Linear search vs. binary
READ TABLE TAB WITH KEY K = 'X'.
READ TABLE TAB WITH KEY K = 'X' BINARY SEARCH.
Comparison of internal tables
DESCRIBE TABLE: TAB1 LINES L1,      
                TAB2 LINES L2.      
IF L1 <> L2.                        
  TAB_DIFFERENT = 'X'.              
ELSE.                               
  TAB_DIFFERENT = SPACE.            
LOOP
AT TAB1.                     
    READ TABLE TAB2 INDEX SY-TABIX. 
    IF TAB1 <> TAB2.                
      TAB_DIFFERENT = 'X'. EXIT.    
    ENDIF.                          
  ENDLOOP.                          
ENDIF.                              
IF TAB_DIFFERENT = SPACE.           
ENDIF.                              
IF TAB1[] = TAB2[].  
ENDIF.               
Modify selected components
LOOP AT TAB.           
TAB-DATE = SY-DATUM. 
MODIFY TAB.          
ENDLOOP.               
WA-DATE = SY-DATUM.                    
LOOP AT TAB.                           
MODIFY TAB FROM WA TRANSPORTING DATE.
ENDLOOP.                               
Appending two internal tables
LOOP AT TAB_SRC.              
  APPEND TAB_SRC TO TAB_DEST. 
ENDLOOP
APPEND LINES OF TAB_SRC TO TAB_DEST.
Deleting a set of lines
LOOP AT TAB_DEST WHERE K = KVAL. 
  DELETE TAB_DEST.               
ENDLOOP
DELETE TAB_DEST WHERE K = KVAL.
Tools available in SAP to pin-point a performance problem
·                The runtime analysis (SE30)
·                SQL Trace (ST05)
·                Tips and Tricks tool
·                The performance database
Optimizing the load of the database
Using table buffering
Using buffered tables improves the performance considerably. Note that in some cases a statement can not be used with a buffered table, so when using these statements the buffer will be bypassed. These statements are:
Select DISTINCT
ORDER BY / GROUP BY / HAVING clause
Any WHERE clause that contains a sub query or IS NULL expression
JOIN s
A SELECT... FOR UPDATE
If you wan t to explicitly bypass the buffer, use the BYPASS BUFFER addition to the SELECT clause.
Use the ABAP SORT Clause Instead of ORDER BY
The ORDER BY clause is executed on the database server while the ABAP SORT statement is executed on the application server. The database server will usually be the bottleneck, so sometimes it is better to move the sort from the database server to the application server.
If you are not sorting by the primary key ( E.g. using the ORDER BY PRIMARY key statement) but are sorting by another key, it could be better to use the ABAP SORT statement to sort the data in an internal table. Note however that for very large result sets it might not be a feasible solution and you would want to let the database server sort it.
Avoid the SELECT DISTINCT Statement
As with the ORDER BY clause it could be better to avoid using SELECT DISTINCT, if some of the fields are not part of an index. Instead use ABAP SORT + DELETE ADJACENT DUPLICATES on an internal table, to delete duplicate rows.
Thanks & regards
Sreenivasulu P

Similar Messages

  • What is the use of for all entries in select statement

    what is the use of for all entries in select statement

    hi,
    FOR ALL ENTRIES is an effective way of doing away with using JOIN on two tables.
    You can check the below code -
    SELECT BUKRS BELNR GJAHR AUGDT
    FROM BSEG
    INTO TABLE I_BSEG
    WHERE BUKRS = ....
    SELECT BUKRS BELNR BLART BLDAT
    FROM BKPF
    INTO TABLE I_BKPF
    FOR ALL ENTRIES IN I_BSEG
    WHERE BUKRS = I_BSEG-BUKRS
    AND BELNR = I_BSEG-BELNR
    AND BLDAT IN SO_BLDAT.
    *******************************8
    look another example
    what is the use of FOR ALL ENTRIES
    1. INNER JOIN
    DBTAB1 <----
    > DBTAB2
    It is used to JOIN two DATABASE tables
    having some COMMON fields.
    2. Whereas
    For All Entries,
    DBTAB1 <----
    > ITAB1
    is not at all related to two DATABASE tables.
    It is related to INTERNAL table.
    3. If we want to fetch data
    from some DBTABLE1
    but we want to fetch
    for only some records
    which are contained in some internal table,
    then we use for alll entries.
    1. simple example of for all entries.
    2. NOTE THAT
    In for all entries,
    it is NOT necessary to use TWO DBTABLES.
    (as against JOIN)
    3. use this program (just copy paste)
    it will fetch data
    from T001
    FOR ONLY TWO COMPANIES (as mentioned in itab)
    4
    REPORT abc.
    DATA : BEGIN OF itab OCCURS 0,
    bukrs LIKE t001-bukrs,
    END OF itab.
    DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
    itab-bukrs = '1000'.
    APPEND itab.
    itab-bukrs = '1100'.
    APPEND itab.
    SELECT * FROM t001
    INTO TABLE t001
    FOR ALL ENTRIES IN itab
    WHERE bukrs = itab-bukrs.
    LOOP AT t001.
    WRITE :/ t001-bukrs.
    ENDLOOP.
    Hope this helps!
    Regards,
    Anver
    <i>if hlped pls mark points</i>

  • 'FOR ALL ENTRIES' in SELECT statements

    Hi,
    I got a doubt in working of the 'FOR ALL ENTRIES' option in the SELECT statement. Here is my scenarion.
    Table A - Document Header Level (Key: Doc Number)
    Internal Table B - Document Item level (Keys: Doc num and Doc Item).
    So, for each record in Table A, table B will have multiple records.
    In this situation, how the below SELECT will work.
    SELECT <field names> INTO <some internal table>
                         FROM A
                         FOR ALL ENTRIES in B
                         WHERE doc_num = B-doc_num.
    Will the above SELECT result in duplicate records or not?
    (I tested it and found that it doesn't! I was lil surprised and wanted to confirm that)
    Thanks & Regards,
    Sree

    Hi,
    For all entries option basically sorts out the entries in the internal tbale based on the where condition and thus it only picks the unique entries based on the list.
    so indeed your table A is a header one so it will give you only single value. if you go by the reverse way where in look for B for all entries in A it will give you multiple values as table B has multiple values for each value in A.
    Regards,
    Jagath

  • Duplicate entries missing using for all entries in select query.

    Hi Gurus,
    Is there any way to avoid missing duplicate entries in an internal table if you use for all entries in select statement?
    Note : i am selecting two tables using non key fields and i have to aggregate the data. I want only 2 data fields and one amount field in my final internal table. I can add all the primary key fields into my internal table and collect my required fields in another table, but  I just want to know is there any other way to avoid missing duplicate entries without adding all the key fields?
    Regards,
    Raghavendra

    Hi,
    Just check what are the other possible fields in the table which may be having
    duplicate entries and make use of them in the selection accordingly.
    You may not miss any entries unless there is any restriction on them.
    You can better judge that in debugging mode while selecting data from that table.

  • Inner joins  Vs  for all entries

    Hi All,
    Pls let me know
    the differences b/w innerjoins and for all entries,,,,which is the best option and  Y??
    Thanks in Advance,
    Bye

    Hi!
    INNER JOIN is used if we want to retrieve some data from more than one table.
    FOR ALL ENTRIES is used if we want some data from a table based on some conditions of some other table.
    Using several nested INNER JOIN statements can be inefficient and cause time out if the tables become too big in the future."
    In ABAP, these joins are first split by the ABAP processor and then sent to the database, with the increase in DATA in production system, these joins tend to give way if your database keeps growing larger and larger.
    You should rather use "FOR ALL ENTRIES IN" (Tabular conditions), which is a much efficient way as far as performance is concerned.
    Check these links:
    inner joins and for all entries
    inner join and for all entries
    Reward points if it helps.
    Regards
    Sudheer

  • Coupling  INNER  JOIN   with   FOR  ALL  ENTRIES  statement

    Hi  All,
         I   am  coupling   INNER  JOIN  with  FOR  ALL  ENTRIES  statement  .....
         Would   you  please  highlight  its  implications ??   Is  it  a  best  practise ? 
         Is  it  advicable  to  use  MULTIPLE   INNER  JOINs  with  a  FOR  ALL  ENTRIES ???
        SORT itab BY matnr.
        IF NOT itab[] IS INITIAL.
          SELECT       epmatnr epebeln ep~ebelp
                       epwerks epmenge ep~netpr
                       ekps_psp_pnr ebbelnr eb~menge
                       INTO TABLE iekpo
                       FROM ekpo AS ep
                       INNER JOIN ekkn AS ek
                       ON  ekebeln = epebeln
                       AND ekebelp = epebelp
                       INNER JOIN ekbe AS eb
                       ON     ebebeln = epebeln
                       AND    ebebelp = epebelp
                       AND    eb~bwart = '101'
                       FOR ALL  ENTRIES IN itab
                       WHERE   ep~matnr = itab-matnr.
          IF sy-subrc EQ 0.
            SORT iekpo BY matnr werks.
            LOOP  AT  itab ASSIGNING  <itab>.
              READ TABLE iekpo WITH KEY matnr = <itab>-matnr
                                        werks = <itab>-werks
                                        BINARY SEARCH.
              IF sy-subrc EQ 0.
                MOVE iekpo-matnr      TO   itab1-matnr.
                MOVE iekpo-ebeln      TO   itab1-ebeln.
                MOVE iekpo-ebelp      TO   itab1-ebelp.
                MOVE iekpo-netpr      TO   itab1-poprice.
                MOVE iekpo-werks      TO   itab1-werks.
                MOVE iekpo-menge      TO   itab1-menge1.
                MOVE iekpo-menge1     TO   itab1-menge2.
                MOVE iekpo-belnr      TO   itab1-belnr.
                MOVE iekpo-ps_psp_pnr TO   itab1-pspel.
                MOVE <itab>-pspel     TO   itab1-tpspel.
                MOVE <itab>-sobkz     TO   itab1-sobkz.
                MOVE <itab>-fo_qty    TO   itab1-fo_qty.
                MOVE <itab>-schgt     TO   itab1-schgt.
                MOVE <itab>-postp     TO   itab1-postp.
                MOVE <itab>-beskz     TO   itab1-beskz.
                pend_qty = iekpo-menge1 - iekpo-menge2.
                MOVE pend_qty         TO   itab1-pending.
                APPEND itab1.
                pend_qty = 0.
              ENDIF.
            ENDLOOP.
          ENDIF.
        ENDIF.
      ENDIF.
    Regards
    Jaman
    Edited by: ABAP Techie on Sep 15, 2008 12:39 PM
    Edited by: ABAP Techie on Sep 15, 2008 12:41 PM

    best practise ... don't know ... it is allowed and o.k.
    If possible you should of coourse to have no FOR ALL ENTRIES at all !
    Joins, there is no general rule, check indexes etc.
    The first SORT, I don't that it help for anything, use it together with the delete adjacent duplicates if you expect duplicates in the driver table.
    o.k., it can help, if there is a loop afterwards and an append inside, because the new table itab1 is then sorted.
    Siegfried

  • Using delete and FOR ALL ENTRIES

    Hi,
    We have a error message regarding the following code :
    Delete FROM TABLE FOR ALL ENTRIES IN lt_TABLE WHERE
    TABLE_KEY1  = LT_TABLE_KEY1
    Could we use the For All entries with "Select" ?
    For information, the error message is "Unable to interpret "FOR". Possible causes: Incorrect spelling or comma error.
    Thank you.

    Hi,
    Check the below syntax, if you want to delete from database
    DELETE FROM sflight
    WHERE  carrid = p_carrid AND
           fldate = sy-datum AND
           seatsocc = 0.
    Just a suggestion. May be from next time you can use F1 help for syntax:
    1. Place the cursor on the delete keword in your program and press F1 - You willl get all the possible syntax for delete statement
    2. Else open the transaction ABAPDOCU, Click Keyword Help, Enter the required keyword(delete in this case) and press cont.. You will get the syntax.
    Hope thsi will help you.
    Regards,
    Swarna Munukoti.

  • For all Enteries in & Ranges Performance Problem

    Is there any soln of For all enteries in & Ranges as
    If i use for all enteries in my report, it becomes slow .
    and if i use Ranges , if no. of record exceeds system will throw dump.
    Since long i couldnt find any good soln for this problem , can anyone guide me
    how to solve this problem.
    Thanks

    Hi All
    I am pasting down query for more expert optimzation comments of the current probs
    SELECT zsd_weigh_bridg1~weight_no zsd_weigh_bridg1~challn_no
               likp~vbeln AS likp_vbeln likp~lfdat
               lips~vgbel
               vbfa~vbeln AS vbfa_vbeln vbfa~vbtyp_n
               mkpf~budat
    *         vtfa~vbeln AS vtfa_vbeln
               ekko~knumv AS ekko_knumv
               ekpo~inco1 ekpo~werks
               APPENDING CORRESPONDING FIELDS OF TABLE lit_in
          FROM zsd_weigh_bridg1
               INNER JOIN likp ON likp~traid = zsd_weigh_bridg1~weight_no
               INNER JOIN lips ON lips~vbeln = likp~vbeln
               INNER JOIN vbfa ON vbfa~vbelv = likp~vbeln
               LEFT OUTER JOIN mkpf ON mkpf~mblnr = vbfa~vbeln
               LEFT OUTER JOIN vtfa ON vtfa~vbelv = vbfa~vbeln
               INNER JOIN ekko ON ekko~ebeln = lips~vgbel
               INNER JOIN ekpo ON ekpo~ebeln = ekko~ebeln
    *           FOR ALL ENTRIES IN git_bridge
          WHERE zsd_weigh_bridg1~weight_no  in r_weight." git_bridge-weight_no ." r_weight.
      ENDIF.
      lit_in_tmp[] = lit_in[].
      DELETE lit_in_tmp  WHERE vbtyp_n NE '8'.
      IF lit_in_tmp[] IS NOT INITIAL.
        SELECT mandt knumv kposn vbeln netwr netpr INTO TABLE lit_vfsi
          FROM vfsi FOR ALL ENTRIES IN lit_in
         WHERE vbeln EQ lit_in-likp_vbeln.
        SELECT mandt tknum vbelv posnv vbtyp_v vbeln posnn vbtyp_n
               INTO TABLE lit_vtfa
          FROM vtfa FOR ALL ENTRIES IN lit_in
         WHERE vbelv EQ lit_in-vbfa_vbeln.
        IF lit_vtfa[] IS NOT INITIAL.
          SELECT mandt fknum fkpos knumv
            FROM vfkp INTO CORRESPONDING FIELDS OF TABLE lit_vfkp
                 FOR ALL ENTRIES IN lit_vtfa
           WHERE fknum EQ lit_vtfa-vbeln.
        ENDIF.
      ENDIF.

  • FOR ALL ENTERIES?

    WHAT IS THE USE OF FOR ALL ENTERIES IN AN INTERNAL TABLE?PLZZ TELL

    Hi,
    FOR ALL ENTRIES works with a database in a quantity-oriented manner. Initially all data is collected in an internal table. Make sure that this table contains at least one entry (query sy-subrc or DESCRIBE), otherwise the subsequent transaction will be carried out without any restrictions).
    SELECT...FOR ALL ENTRIES IN is treated like a SELECT statement with an external OR condition. The system only selects those table entries that meet the logical condition .
    Using FOR ALL ENTRIES is recommended when data is not being read from the database, that is, it is already available in the program, for example, if the user has input the data. Otherwise a join is recommended.
    Here is sample program for FOR ALL  ENTRIES:
    DATA:it_ekko LIKE ekko OCCURS 0 WITH HEADER LINE.
    DATA:it_ekpo LIKE ekpo  OCCURS 0 WITH HEADER LINE.
    START-OF-SELECTION.
      SELECT * FROM ekko INTO TABLE it_ekko UP TO 10 ROWS.
      IF NOT it_ekko[] IS INITIAL.
        SELECT * FROM ekpo INTO TABLE it_ekpo
        FOR ALL ENTRIES IN it_ekko
        WHERE ebeln = it_ekko-ebeln.
      ENDIF.
      LOOP AT it_ekko.
        WRITE:/ it_ekko-ebeln.
        HIDE it_ekko-ebeln.
      ENDLOOP.
    AT LINE-SELECTION.
      LOOP AT it_ekpo WHERE ebeln = it_ekko-ebeln.
        WRITE:/ it_ekpo-ebelp,it_ekpo-ebeln.
      ENDLOOP.
    Regds
    Sivaparvathi
    Please reward points if helpful....

  • Inner Joins vs For All Entries - performance query

    Hi All,
    I'm a bit confused here...  I see lots and lots (and lots...) of postings from people asking how to get data from multiple tables.
    To me the immediate answer is to use joins in my select statement to reduce the database load but more and more I see people suggesting FOR ALL ENTRIES is better from a performance perspective.
    Now, simple question time, which is more efficient in the real world when doing something like the following:- (this is a basic example but I'm sure you know what I mean.)
    Select  *
      into  table lt_sales_data
      from  vbap as vbap
    inner  join vbak as vbak
         on vbak~vbeln eq vbap~vbeln
      where  vbak~vbeln in so_vbeln.
    or
    Select  *
      into  table lt_vbak_data
      from  vbak
    where  vbeln in so_vbeln.
    if lt_vbak_data[] is not initial.
    select  *
      into  table lt_vbap_data
      from  vbap
      for all entries in lt_vbak_data
    where  vbeln eq lt_vbak_data-vbeln.
    endif.
    Basically I want to know whether joins or for all entries is better from a database performance perspective.
    I want to know why as well so please don't just post links, random cut and paste answers or one liners.  I'm convinced for all entries is slower but am willing to be persuaded otherwise if someone can show me proof.
    Thanks,
    Gareth.

    Thanks to all the opinions so far...  You've backed up what I suspected although I maybe wasn't clear enough with my question and desired result.  I was hoping someone could produce some hard and fast guidelines from SAP themselves dictating which is the better method.  I know 10 years ago I was taught to use joins and to keep my database access to minimal levels, using keyed reads where applicable and using internal tables to filter data where I couldn't use key fields.
    Gautham, I am aware of SM30 but that doesn't answer the general question I was asking.  I've obviously used SM30 to run some comparisons but I was really hoping someone could give me a definitive answer based on hard facts or from attending some training at SAP recently.  And no points for asking for them
    Tamás, I agree with what you are saying about runing many comparisons - it appears to be dependant on any number of criteria which means each case may require different code.  I've not managed to find a consistent comparison of the two methods that would lead me to use one method or the other...
    Karan, thanks for your feelings but it doesn't really help me!  Why/how does it retrieve the data faster than a join?  Have you got testing/proof to back this up?
    Raam, thanks for those links - they are interesting reads and seem to go through the same arguments I'm currently considering.  Although I still don't have a definitie answer!
    Amit, I understand exactly what yuo are saying about myths and urban legends   That was my motivation for this post.  To bo honest, it seems to me that a lot of the "newer" ABAP coders always go for FOR ALL ENTRIES but I wanted to know - is there a reason or do they all just cut and paste off SDN?!  Are they all just scared of complex inner joins?!  What would you all make of this Select statement for example? -   
    select  afvc~arbid
                afko~aufnr
                aufk~objnr
                afko~plnnr
                afko~plnal
                afko~aufpl
                afko~zaehl
                afpo~matnr
                makt~maktx
                afvc~vornr
                afvc~ltxa1
                afvu~aplzl
                afvu~usr10
                afvv~meinh
                afvv~bmsch
                afvv~vge02
                afvv~vgw02
                afvv~mgvrg
                afab~aplzl_vor
          into  table lt_recipe_orders
          from  afko as afko
         inner  join aufk as aufk
            on  aufk~aufnr eq afko~aufnr
         inner  join afpo as afpo
            on  afpo~aufnr eq afko~aufnr
         inner  join makt as makt
            on  makt~matnr eq afpo~matnr
         inner  join afvc as afvc
            on  afvc~aufpl eq afko~aufpl
         inner  join afvu as afvu
            on  afvu~aufpl eq afvc~aufpl
           and  afvu~aplzl eq afvc~aplzl
         inner  join afvv as afvv
            on  afvv~aufpl eq afvu~aufpl
           and  afvv~aplzl eq afvu~aplzl
          left  outer join afab as afab
            on  afab~aufpl_nch eq afvu~aufpl
           and  afab~aplzl_nch eq afvu~aplzl
           for  all entries in t_resources
         where  afko~gltrs ge v_start_date
           and  afko~gstrs le v_start_date
           and  afko~plnty eq gc_task_list_type_2
           and  afpo~dwerk eq v_werks
           and  makt~spras eq sy-langu
           and  afvc~arbid eq t_resources-objid.
    Twinkal, I've always thought less DB hits is a better performing program too - the above example compares 2 db hits to 1...  I don't have issues with complex joins because I've used them so long so can discount that problem but do agree that less DB hits is the ultimate goal.  Providing of course the Selects you write are actually efficient in themselves.
    Murthy, if you build your select statement correctly duplicate records can be avoided in most cases.  How can you say a join statement will hit the database more when in my example there is 1 DB hit compared to 2 for a for all entries?  And I'd love to know the reasoning behind never using a join on more than 2 tables?!  Is that just an urban myth?!
    Thomas, I've just been looking at some of Siegfried's posts and like what I am reading.  As you say, using full keys via joins is essential.
    Gareth.

  • How to use bind variable value for table name in select statement.

    Hi everyone,
    I am having tough time to use value of bind variable for table name in select statement. I tried &p37_table_name. ,
    :p37_table_name or v('p37_table_name) but none worked.
    Following is the sql for interactive report:
    select * from v('p37_table_name') where key_loc = :P37_KEY_LOC and
    to_char(inspection_dte,'mm/dd/yyyy') = :P37_INSP_DT AND :p37_column_name is not null ;
    I am setting value of p37_table_name in previous page which is atm_state_day_insp.
    Following is error msg:
    "Query cannot be parsed, please check the syntax of your query. (ORA-00933: SQL command not properly ended) "
    Any help would be higly appreciated.
    Raj

    Interestingly enough I always had the same impression that you had to use a function to do this but found out from someone else that all you need to do is change the radio button from Use Query-Specific Column Names and Validate Query to Use Generic Column Names (parse query at runtime only). Apex will substitute your bind variable for you at run-time (something you can't normally do in pl/sql without using dynamic sql)

  • Once and for All ---- Please

    Hello all,
    I have used CF for several years now and bought Flex as soon
    as it was released. In my process of understanding how Flex handled
    Remote objects for CF I decided to use the CF Builder wizard for
    Flex that creates all kinds of nice CFC's and stuff for me to
    connect to a database and CRUD the data within. Ok all fine and
    dandy on the local machine, works great, I am impressed! That is
    until I try to upload the app to my Shared Server (HMS) and I get
    all kinds of cryptic error messages like:
    (mx:rpc:Fault)#0 error id = 0
    faultCode ='Client.Error.MessageSend"
    faultDetail = "Channel.Connect.Failed error
    NetConnection.Call.Failed :HTTP:Status 500"
    faultString = "Send Failed"
    message = "faultCode.Client.Error.MessageSend
    faultString:'Send Failed'
    faultDetail:'Channel.Connect.Failed error
    NetConnection.CallFailed: HTTP: Status 500" name = "Error"
    rootCause = (Object)#1
    code = NetConnection.Call.Failed"
    description = "HTTP: Status 500"
    details = "
    http://www.MYDOMIAN.com/flex2gateway/"
    level = "error"
    So I have read the DOCs and read all the blogs I can find on
    the subject but no one can clearly answer as to why I can not make
    this work on a Shared Server if I can make it work on my local box,
    Heck I can even tap into the MySQL database on the Shared Server
    via the Flex builder. I use HostMySite.com with the CF package if
    that helps.
    If it is just a matter of something on my hosts end I need
    them to configure for me that would be nice to know, or if I simply
    can't use Flex and CF together on a Shared Server all together.
    That would be nice to know. But for all the hype Flex is getting
    and how easy it supposed to be to create an app with CF, I am
    wondering why someone can not answer this question once and for
    all. I know others have posted to this and many other forums asking
    the same things I am. Is it too much to ask one of the Flex Gurru's
    of Adobe, or anywhere else for that matter to help us out?
    Not everyones wants to run their own server and I would think
    that Adobe would have kept that in mind when creating Flex, and how
    it would run on shared servers.
    So please if anyone can help understand this please let me
    know.
    Thanks

    Halodev / Peter,
    I was JUST about to ask the same question. The problem I was
    having was migrating a Flex app created on my local machine,
    connecting with my local CF app, to a test (model of production)
    server.
    I knew the following:
    1) The flex app worked as expected
    2) The data was not an issue, as I mapped a datasource to my
    production DB
    My main concern was getting the Flex app to work on the test
    server, but my biggest issue was the fact that the setup of my
    local and test servers are different. Example, I have a single
    instance locally, running off localhost. On my test server, I have
    multiple JRUN instances on the D-drive (as opposed to the c-drive,
    locally).
    From this post, I figured out that I needed to change the
    project properties to account for the different location of the
    flex-config file. I right clicked on the project and selected
    properties, and altered the values in the "Flex Compiler" and "Flex
    Server" sections to reflect the TEST server locations of the
    flex-config file.
    Now, to make life hard on myself, the "d" drive on my laptop
    is the CD ROM, and when I tried to enter the path in FB, I got an
    error saying that the path was invalid. I looked into partitioning
    my drive, but I was warned off it by our tech guy here (besides, it
    seemed too much like real work!). SO, I burned a CD with the proper
    path, just as a temporary solution.
    I re-built the app, and deployed ALL of the files in the
    local projects "bin" directory. It worked, eventually, but there
    are some questions I have, maybe, Peter, if you read this you could
    help.
    1) I had trouble with SSL - my test servers use them (as do
    the production servers). The SWF started to load but I got a 403
    error (that is SSL related, I believe). I'm not sure if that was
    when it was loading, or trying to access the CFC. Any thoughts on
    this? Are there known SSL issues?
    2) The whole "D" drive thing was a pain. As I mentioned, I
    have multpile JRUN instances on my Test (and Dev) server - one for
    each site. If I created a single generic site on the c-drive, would
    all sites that access flex be able to use that flex-config file, or
    do they need to access the local file? I'm not really getting how
    the flex services-config.xml file relates. Maybe I'll re-read your
    posts in this thread.
    3) Do I need to copy all the files from the bin directory, or
    is that over-kill? What is the bare-minimum code I need to get the
    Flex SWF to run? Could I just copy a sub-set of the HTML to a
    content management system?
    Any help with the above is appreciated.
    I'm not sure if I answered the original question, or
    contributed positively to this post - I hope I did, and that
    someone will find this information useful in the future.
    Cheers guys,
    David

  • Once-and-for-all Authentification in Finder / Terminal

    Hello I need to install somethings (namely Font files … but this is irrelevant)
    in a certain Folder not part of my User Folder (though I am the Admin of my Machine).
    Should I do this manually, then must I enter my Password / Authentication upon each Action.
    Unnerving!
    I would like to be able to Authentify once-and-for-all (during a Session of editting);
    then perform my Tasks, then switch of my Authentication.
    (1.) Is this Possible (in Lion)?
    (2.) When yes, how?
    Note: I have vague Memories of doing this in Leopard (10.5.8), so this isn’t at all
    a wildly improbably thing.
    Thanks in Advance, should anyone constructively reply.

    You should never have to enable the root user.
    Tony Rombaldi posted this at MacInTouch. Give it a try:
    When you use the Disk Utility app and Repair Permissions, it doesn't actually repair the permission settings on folders and files in your Home folder, where your documents and personal applications may reside.
    In Lion, there is an additional Repair Permissions application utility hidden away. This tool is located inside boot Repair Utilities. Here's how to access it.
    1. Restart Lion and hold down the Command and R keys.
    2. You will boot into the Repair Utilities screen. On top, in the Menu Bar click the Utilities item, then select Terminal.
    3. In the Terminal window, type resetpassword and hit Return.
    4. The Password reset utility launches, but you're not going to reset the password. Instead, click on the icon for your Mac's hard drive at the top. From the drop-down below it, select the user account where you are having issues.
    5. At the bottom of the window, you'll see an area labeled 'Reset Home Directory Permissions and ACLs'. Click the Reset button there.
    The reset process takes a couple of minutes. When it's done, quit the programs you've opened and restart your Mac. Notice that 'Spotlight' starts re-indexing immediately.

  • INNER JOIN with FOR ALL ENTRIES IN Performance ?

    I am using following the following <b>Select using Inner join with For All Entries in.</b>
          SELECT kebeln kebelp kvbeln kvbelp
            FROM ekkn AS k INNER JOIN ekbe AS b ON kebeln = bebeln
                                               AND kebelp = bebelp
            INTO TABLE gi_purchase
             FOR ALL ENTRIES
             IN gi_sales
          WHERE k~mandt EQ sy-mandt
            AND k~vbeln EQ gi_sales-vbeln
            AND k~vbelp EQ gi_sales-posnr
            AND b~budat EQ p_date.
    If i am not doing inner join then I will have to do 2 select with for all entries in on ekkn and ekbe tables and then compare them.
    <b>I want to know which one has better performance
    Inner join with for all entries in
                    or
    2 Selects with for all entries in</b>

    the join is almost aways faster:
    <a href="/people/rob.burbank/blog/2007/03/19/joins-vs-for-all-entries--which-performs-better">JOINS vs. FOR ALL ENTRIES - Which Performs Better?</a>
    <a href="http://blogs.ittoolbox.com/sap/db2/archives/for-all-entries-vs-db2-join-8912">FOR ALL ENTRIES vs DB2 JOIN</a>
    Rob

  • Inner Join with For All Entries - Performance ?

    I am using following the following <b>Select using Inner join with For All Entries in.</b>
          SELECT kebeln kebelp kvbeln kvbelp
            FROM ekkn AS k INNER JOIN ekbe AS b ON kebeln = bebeln
                                               AND kebelp = bebelp
            INTO TABLE gi_purchase
             FOR ALL ENTRIES
             IN gi_sales
          WHERE k~mandt EQ sy-mandt
            AND k~vbeln EQ gi_sales-vbeln
            AND k~vbelp EQ gi_sales-posnr
            AND b~budat EQ p_date.
    If i am not doing inner join then I will have to do 2 select with for all entries in on ekkn and ekbe tables and then compare them.
    <b>I want to know which one has better performance
    Inner join with for all entries in
                    or
    2 Selects with for all entries in</b><b></b>

    An Inner Join with for all entries should be done if you add this....
    IF NOT gi_sales[] IS INITIAL.
    SELECT k~ebeln k~ebelp k~vbeln k~vbelp
    FROM ekkn AS k INNER JOIN ekbe AS b ON k~ebeln = b~ebeln
    AND k~ebelp = b~ebelp
    INTO TABLE gi_purchase
    FOR ALL ENTRIES
    IN gi_sales
    WHERE k~mandt EQ sy-mandt
    AND k~vbeln EQ gi_sales-vbeln
    AND k~vbelp EQ gi_sales-posnr
    AND b~budat EQ p_date.
    ENDIF.
    Also, while you use an index or the complete key for the SELECT, your not going to suffer from lack of performance -;)
    Greetings,
    Blag.

Maybe you are looking for

  • Windows detects my ipod but itunes doesnt, it doesnt let me sync it

    Hello, I am here because ive been struggling to connect my ipod (5th Generation) to iTunes. However, it does connect to windows. When clicking on iTunes, I sign in to my ID, I click 'file' in the top right corner, I then hover over devices, but it do

  • Memory Not Working, PLEASE HELP!!!!????

    I have a Dual 2 GHz PowerPC G5 Apple PowerMac G5 Tower Computer with 2GB DDR SDRAM made up of Nanya (4) 512MB Sticks of RAM, currently. I recently bought 2 x 1GB sticks of ram 1GB DDR-400MHz-CL3 PC3200U-30331 elixir. i put them in 1 at a time and put

  • Emails show up on web but not in Outlook 2013 inbox

    I have several email accounts and one of them that is working fine on Outlook 2013 is set up as a Microsoft Exchange account. But the other ones are set up as IMAP/SMTP accounts and the emails don't show up in the inbox, only on the web. When I check

  • Just too many problems, iMovie, iDVD

    After working with the same project for the past 2 weeks and getting nowhere, I finally gave up in total frustration and deleted the entire project, one piece at a time. I spent the last hour today starting at, 10:45 Am Alaska time and tracked down e

  • Critical Alert Appear

    Dear All I receive critical alert from my C350 and i am not sure what this mean. The Critical message is: An application fault occurred: ('Lib/re.py _compile|233', "<class>", 'nothing to repeat', '[util/Aquarium.py screenLoop|407] [util/InternalLibra