For all entries query
Hi,
can we do a for all entries with a table type parameter.
select * from <tablename> for all entries in <internal table> (importing parameter in an FM a table type parameter)....where <cond>
go thrugh this and check dynamic select it may help you
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/840ad679-0601-0010-cd8e-9989fd650822#q-16">https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/840ad679-0601-0010-cd8e-9989fd650822#q-16</a>
regards
shiba dutta
Similar Messages
-
Performance issue with select query and for all entries.
hi,
i have a report to be performance tuned.
the database table has around 20 million entries and 25 fields.
so, the report fetches the distinct values of two fields using one select query.
so, the first select query fetches around 150 entries from the table for 2 fields.
then it applies some logic and eliminates some entries and makes entries around 80-90...
and then it again applies the select query on the same table using for all entries applied on the internal table with 80-90 entries...
in short,
it accesses the same database table twice.
so, i tried to get the database table in internal table and apply the logic on internal table and delete the unwanted entries.. but it gave me memory dump, and it wont take that huge amount of data into abap memory...
is around 80-90 entries too much for using "for all entries"?
the logic that is applied to eliminate the entries from internal table is too long, and hence cannot be converted into where clause to convert it into single select..
i really cant find the way out...
please help.chinmay kulkarni wrote:Chinmay,
Even though you tried to ask the question with detailed explanation, unfortunately it is still not clear.
It is perfectly fine to access the same database twice. If that is working for you, I don't think there is any need to change the logic. As Rob mentioned, 80 or 8000 records is not a problem in "for all entries" clause.
>
> so, i tried to get the database table in internal table and apply the logic on internal table and delete the unwanted entries.. but it gave me memory dump, and it wont take that huge amount of data into abap memory...
>
It is not clear what you tried to do here. Did you try to bring all 20 million records into an internal table? That will certainly cause the program to short dump with memory shortage.
> the logic that is applied to eliminate the entries from internal table is too long, and hence cannot be converted into where clause to convert it into single select..
>
That is fine. Actually, it is better (performance wise) to do much of the work in ABAP than writing a complex WHERE clause that might bog down the database. -
Dynamic Select Query including Dynamic Tables with For all Entries
Hello everyone,
I need to create a select query which involves using of Dynamic Tables.
Suppose I have a dynamic table <d1> which consist of let say 10 records.
Now i need to make a select query putting data into another dynamic table <d2>
CONCATENATE keyfield '=' '<d1>' INTO g_condition SEPARATED BY space.
CONCATENATE g_condition '-' keyfield INTO g_condition.
SELECT * FROM (wa_all_tables-name) INTO CORRESPONDING FIELDS OF TABLE <d1>
FOR ALL ENTRIES IN <d1>
WHERE (g_condition).
But it is giving dump.
Please help me on this....Short text
A condition specified at runtime has an unexpected format.
What happened?
Error in the ABAP Application Program
The current ABAP program "ZNG_CUSTOMWRITE" had to be terminated because it has
come across a statement that unfortunately cannot be executed.
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_DYNAMIC_OSQL_SEMANTICS', was
not caught in
procedure "WRITE_ARCHIVE_PROD" "(FORM)", nor was it propagated by a RAISING
clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
The current ABAP program has tried to execute an Open SQL statement
which contains a WHERE, ON or HAVING condition with a dynamic part.
The part of the WHERE, ON or HAVING condition specified at runtime in
a field or an internal table, contains the invalid value "ZCOURIER-ZCOURIERID".
CONCATENATE keyfield '=' g_header INTO g_condition SEPARATED BY space.
CONCATENATE g_condition '-' keyfield INTO g_condition.
SELECT * FROM (wa_all_tables-name) INTO CORRESPONDING FIELDS OF TABLE <dyn_table1>
FOR ALL ENTRIES IN <dyn_table>
WHERE (g_condition). -
Performance optimization on select query for all entries
Hi All,
I want to optimize the select query in my Program.
The select query is taking lot of time to search the records for the given condition in the where clause
and more interestingly there are no records fetched from the database as the where condition does not matches.
It is taking more than 30 min to search the record and the result is no record found.
Below is my select query. I have also created the secondary Index for the same.
In My opinion FOR ALL ENTRIES is taking lot of time. Because there are more than 1200 records in internal table t_ajot
select banfn bnfpo bsart txz01 matnr Werks lgort matkl reswk menge meins flief ekorg
INTO CORRESPONDING FIELDS OF TABLE t_req
FROM eban
FOR ALL ENTRIES IN t_ajot
WHERE matkl >= t_ajot-matkl_low
AND matkl <= t_ajot-matkl_high
AND werks = t_ajot-werks
AND loekz = ' '
AND badat IN s_badat
AND bsart = 'NB'.
Please suggest.Hi,
that,
FOR ALL ENTRIES IN t_ajot
WHERE matkl >= t_ajot-matkl_low
AND matkl <= t_ajot-matkl_high
AND werks = t_ajot-werks
AND loekz = ' '
AND badat IN s_badat
AND bsart = 'NB'.
looks strange.
However:
How does your index look like?
What executoin plan do you get?
How do the statistics look like?
Whats the content of the variables t_ajot-... and s_badata?
Kind regards,
Hermann -
FOR ALL ENTRIES stmnt. in SELECT query is not running properly
Hello experts,
In my report program, I write one query on table BSIS.
Internal table declaration -
DATA : BEGIN OF DLC_BSIS OCCURS 0,
BUKRS LIKE BSIS-BUKRS,
GJAHR LIKE BSIS-GJAHR,
BELNR LIKE BSIS-BELNR,
SHKZG LIKE BSIS-SHKZG,
BSCHL LIKE BSIS-BSCHL,
AUFNR LIKE BSIS-AUFNR,
HKONT LIKE BSIS-HKONT,
QSSKZ LIKE BSIS-QSSKZ,
DMBTR LIKE BSIS-DMBTR,
END OF DLC_BSIS.
Query as follows --
SELECT BUKRS
GJAHR
BELNR
AHKZG
BSCHL
AUFNR
HKONT
QSSKZ
DMBTR FROM BSIS
INTO TABLE DLC_BSIS
FOR ALL ENTRIES IN IT_BKPF2
WHERE BELNR = IT_BKPF2-BELNR
AND BUKRS = IT_BKPF2-BUKRS
AND GJAHR = IT_BKPF2-GJAHR.
IT_BKPF2 internal table having -- BUKRS - LT01
BELNR - 6400000061
GJAHR - 2009.
And in BSIS database table -- 3 entries are there for the above documnet.
But, in my internal only one entry has come for the same above document.
I think For all entries stmnt. is not running properly. But Why it's not running properly.??
What would be the reason..??
Thanks in advance....!!
Regards,
Poonam.>
Poonam Patil wrote:
> Hello experts,
> In my report program, I write one query on table BSIS.
>
> Internal table declaration -
>
> DATA : BEGIN OF DLC_BSIS OCCURS 0,
> BUKRS LIKE BSIS-BUKRS,
> GJAHR LIKE BSIS-GJAHR,
> BELNR LIKE BSIS-BELNR,
> SHKZG LIKE BSIS-SHKZG,
> BSCHL LIKE BSIS-BSCHL,
> AUFNR LIKE BSIS-AUFNR,
> HKONT LIKE BSIS-HKONT,
> QSSKZ LIKE BSIS-QSSKZ,
> DMBTR LIKE BSIS-DMBTR,
> END OF DLC_BSIS.
>
> Query as follows --
>
> SELECT BUKRS
> GJAHR
> BELNR
> AHKZG
> BSCHL
> AUFNR
> HKONT
> QSSKZ
> DMBTR FROM BSIS
> INTO TABLE DLC_BSIS
> FOR ALL ENTRIES IN IT_BKPF2
> WHERE BELNR = IT_BKPF2-BELNR
> AND BUKRS = IT_BKPF2-BUKRS
> AND GJAHR = IT_BKPF2-GJAHR.
>
> IT_BKPF2 internal table having -- BUKRS - LT01
> BELNR - 6400000061
> GJAHR - 2009.
>
> And in BSIS database table -- 3 entries are there for the above documnet.
>
> But, in my internal only one entry has come for the same above document.
>
> I think For all entries stmnt. is not running properly. But Why it's not running properly.??
> What would be the reason..??
>
>
> Thanks in advance....!!
>
> Regards,
> Poonam.
include the buzei field in selection criteria i have faced the same situation earlier.
always select all the key fields.
varun -
Select query 'for all entries'
Hello Friends,
SELECT emp_id emp_name
INTO corresponding fields of table itab_emp
FROM employee
for all entries in itab_dept
WHERE emp_id = itab_dept_emp_id.
In the above select query we are using 'for all entries' for the internal table itab_dept.What will happen if the join fails?Will we get any data in the output table?
What is the prerequisites for using 'for all entries'.
Please advice me on this.
Regards
Ashish.Hi
In this case all the records available in employee table are extracted into internal table itab_emp.
It is safe to check whether itab_dept is initial or not.
If it is initial then stop the select query.
Check the following program u will get an idea.
Also try this program by removing comment to 'REFRESH IT_LFA1'.
REPORT ZBM_PG .
TABLES: LFA1, EKKO.
DATA:
IT_LFA1 TYPE TABLE OF LFA1 WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 10,
IT_LFA1 TYPE TABLE OF LFA1 WITH HEADER LINE,
IT_EKKO TYPE TABLE OF EKKO WITH HEADER LINE.
SELECT * FROM LFA1 INTO TABLE IT_LFA1 WHERE LIFNR EQ '0000001000' OR LIFNR EQ '0000001500'.
SELECT * FROM LFA1 INTO TABLE IT_LFA1 UP TO 1 ROWS.
refresh it_lfa1.
SELECT * FROM EKKO INTO TABLE IT_EKKO FOR ALL ENTRIES IN IT_LFA1 WHERE LIFNR = IT_LFA1-LIFNR.
LOOP AT IT_EKKO.
WRITE: / IT_EKKO-LIFNR, IT_EKKO-EBELN.
ENDLOOP.
Reward me if it is useful -
Usage of FOR ALL ENTRIES in SELECT query
Hi All,
While writing SELECT query using FOR ALL ENTRIES, in the WHERE condition can we use IN operator on a range table?
Will this work out.
Thanks,
Anil KumarHI,
Yes you can use the in operator.
SELECT *
FROM MARC
INTO TAB:E i_mARC
FOR ALL ENTRIES IN I_MARA
WHERE MATNR EQ I_MARA_MATNR
AND WERKS IN S_WERKS. -
Select query like For all Entries
Hi,
I have a requirement like:
I need to extract data (BKTXT) from table BKPF based on some criteria, into one internal table and I need to query on REGUP table for the above data, the selection criteria on REGUP as follows:
BKTXT(Document Header Text with 25 Char) is a combination of DATE and character string.
Ex: bkpf-bktxt = 20060710-PL02 (YYYYMMDD)
it is like LAUFD + LAUFI (of table REGUP)
i.e: LAUFD (REGUP) = 07/10/2006 (MM/DD/YYYY) and LAUFI(REGUP) = PL02
here I am thinking to use a select query on REGUP using FOR ALL ENTRIES of table i_bkpf..
How can I change the date format YYYYMMDD to MM/DD/YYYY for my requirement?
(( Run-on Date (REGUP-LAUFD) = the first 8 characters in the Document Header Text (BKPF- BKTXT) in MM/DD/YYYY date format (e.g. 07/10/2006)
Run ID (REGUP-LAUFI) = the 10th character through the 15th character in the Document Header Text (BKPF- BKTXT)It is not possible to do in the way you are thinking of doing. "For all entries" requires you to have the itab table field and the database table field to have the same type and length. So something like below <u>will not work</u>.
TABLES: regup.
DATA: BEGIN OF itab OCCURS 0,
text LIKE bkpf-bktxt.
DATA: END OF itab.
DATA: BEGIN OF itab_regup OCCURS 0.
INCLUDE STRUCTURE regup.
DATA: END OF itab_regup.
SELECT * INTO TABLE itab_regup
FROM regup FOR ALL ENTRIES IN itab
WHERE laufd = itab-text+0(8).
If you run this code, you will get an error as follows:
<i>"When using the addition "FOR ALL ENTRIES IN itab", the fields "LAUFD" and "ITAB-TEXT+0(8)" must have the same type and length."</i> -
Want to Avoid Loop for all entries with select query !!
Hi Guru's !
This is my following code . I want to avoid loop to improve the performance of program.
data: lt_cuhd type HASHED TABLE OF /sapsll/cuhd WITH UNIQUE key guid_cuhd,
ls_cuhd type /sapsll/cuhd.
data: lt_comments type STANDARD TABLE OF zss_comments,
ls_comments type zss_comments.
data: lv_objkey type string.
select * from /sapsll/cuhd into table lt_cuhd.
loop at lt_cuhd into ls_cuhd.
CONCATENATE ls_cuhd-corder '%' into lv_objkey. " Example 'Mum%'
select * from zss_comments into table lt_comments
where objkey like lv_objkey
AND guid_cuhd = ls_cuhd-guid_cuhd
AND event_id <> ''.
endloop.
I want
New code should be...using all entries no loop required.
*select * from zss_comments into table lt_comments
where objkey like lv_objkey
AND guid_cuhd = ls_cuhd-guid_cuhd
AND event_id <> ''.*why dont you add the object key also to lt_cuhd and once you fetch the data to lt_cuhd loop it and add the '%'
when looping use field symbols so that you dont have to use modify.
then use for all entries using lt_cuhd
i don't you can find a better way to add the % mark apart from looping but by this way only one select query will be done for
zss_comments
Thanks
Nafran -
Is "Joins & For all entries" in same SQL Query Possible?
Hi all Professional,
Can we use "Inner Joins" and "For All Entries In" in the same SQL Query. if possible then pls clarify this query.
Here I am using three Transparent Table and fetching data from them.
SELECT abukrs abelnr ahkont axref2 ashkzg awrbtr agsber azfbdt azterm amwskz asgtxt axref1 agjahr abuzei
bkunnr bwerks bmenge bmeins bmatnr bkoart
cbukrs cbelnr cblart cbldat cbudat cxblnr cgjahr cstgrd cstblg cstblg c~xreversal
INTO CORRESPONDING FIELDS OF TABLE it_bsid FROM ( ( bsid AS a
INNER JOIN acctit AS b ON abukrs = bbukrs )
INNER JOIN bkpf AS c ON cbukrs = abukrs
AND cbelnr = abelnr
AND cgjahr = agjahr )
FOR ALL ENTRIES IN it_bkpf
WHERE
a~belnr EQ it_bkpf-belnr
AND a~gjahr EQ it_bkpf-gjahr
AND a~bukrs EQ it_bkpf-bukrs
AND a~gsber IN so_bus.
After executing this query, I'm getting Dump Error.
Error analysis
When the program was running, it was established that more
memory was needed than the operating system is able to provide savely.
To avoid a system crash, you must prevent this
situation.
Last error logged in SAP kernel
Component............ "EM"
Place................ "SAP-Server Development_DVL_01 on host Development (wp
2)"
Version.............. 37
Error code........... 7
Error text........... "Warning: EM-Memory exhausted: Workprocess gets PRIV "
Description.......... " "
System call.......... " "
Module............... "emxx.c"
Line................. 1886
Pls resolve, if anybody knows.
Thanks
DevinderHi,
During testing i notice that splitting into multiple selects does improve performance. But the best performance I achieved using DB Hints instead of splitting the select statements.
Generally performance of joins together with for all entries is bad.
However if you will look into SAP note 1662726 you will notice that this issue (bad performance in using join and for all entries together) has been addressed.
Even though the note is for HANA DB, FM RSDU_CREATE_HINT_FAE can be used independent of DB.
On HANA DB performance improvement is huge (i achieved 62 seconds using DB Hints compared to 1656 seconds using for all entries). On Oracle DB the same code initially run in 99 seconds with for all entries and with DB Hints in 82 seconds for ~ 1.000.000 records and ~660 seconds compared to 1349 seconds for ~8.000.000 records..
Sample code from SAP Note below:
Original statement:
SELECT COL1 COL2 COL3 COL4 COL5
FROM TAB1
INTO CORRESPONDING FIELDS OF TABLE LT_RESULT
FOR ALL ENTRIES IN LT_SOURCE_TMP
WHERE COL3 = LT_SOURCE_TMP-COL3
AND COL4 = LT_SOURCE_TMP-COL4
AND COL5 = LT_SOURCE_TMP-COL5
Revision:
DATA: L_T_TABLNM TYPE RSDU_T_TABLNM,
L_LINES TYPE I,
L_HINT TYPE RSDU_HINT.
APPEND 'TAB1' TO L_T_TABLNM.
L_LINES = LINES( LT_SOURCE_TMP ).
CALL FUNCTION 'RSDU_CREATE_HINT_FAE'
EXPORTING
I_T_TABLNM = L_T_TABLNM
I_FAE_FIELDS = 3
I_FAE_LINES = L_LINES
I_EQUI_JOIN = RS_C_TRUE
IMPORTING
E_HINT = L_HINT
EXCEPTIONS
OTHERS = 0.
SELECT COL1 COL2 COL3 COL4 COL5
FROM TAB1
INTO CORRESPONDING FIELDS OF TABLE LT_RESULT
FOR ALL ENTRIES IN LT_SOURCE_TMP
WHERE COL3 = LT_SOURCE_TMP-COL3
AND COL4 = LT_SOURCE_TMP-COL4
AND COL5 = LT_SOURCE_TMP-COL5
%_HINTS ADABAS L_HINT.
Best regards,
Octavian -
Make this query into for all entries
Hello Experts,
please change this query into for all entries to increase performance
loop at itab1.
SELECT single b~vtext INTO itab2
FROM vbkd AS a
INNER JOIN tvkggt AS b
ON akdkg1 = bkdkgr
WHERE a~vbeln EQ itab1-vbeln_vauf
AND a~posnr EQ itab1-posnr_vauf.
endloop.
Thank you so much for all the replies.as I write again and again, then performance is mainly increased but correct index usage
SELECT single b~vtext
INTO itab2
FROM vbkd AS a
INNER JOIN tvkggt AS b
ON ..... spras ???
bkdkgr = akdkg1
WHERE a~vbeln EQ itab1-vbeln_vauf
AND a~posnr EQ itab1-posnr_vauf.
You access vbkd with the primary key vbeln and posnr
and then you switch to tvkggt where you need spras and kdgr for the primary key
With spras you statement is incorrect you get one text it is unclear in which language,
it might be that there is onyl one, but still you *** it to the statement to use the index.
spras = sy-langu might be o.k.
I.e.
IF NOT ( itab1 is initial ).
SELECT single b~vtext
INTO itab2
FROM vbkd AS a
INNER JOIN tvkggt AS b
ON b~spras = sy_langu
b~kdkgr = a~kdkg1
FOR ALL ENTRIES in itab1
WHERE a~vbeln EQ itab1-vbeln_vauf
AND a~posnr EQ itab1-posnr_vauf.
ENDIF.
Siegfried -
For all entries in select query
Hi Guys,
I am fetching the BUKRS GJAHR BELNR and BUZEI from BSEG table, using for all entires of BSEG data, i am getting the data from BSID table.
But in BSID table, i have duplicate records, those records i am not able to get.
Could you please suggest me, is any wrong in my code. Please sugest is any other way to get the data.
SELECT bukrs
belnr
gjahr
buzei
xref1 INTO TABLE it_bseg
FROM bseg
WHERE bukrs = p_bukrs
AND gjahr IN s_gjahr
AND xref1 IN s_xref1.
SORT it_bseg BY bukrs gjahr belnr buzei.
SELECT bukrs
kunnr
zuonr
gjahr
belnr
budat
bldat
xblnr
blart
dmbtr
shkzg INTO TABLE it_bsid
FROM bsid
FOR ALL ENTRIES IN it_bseg
WHERE bukrs = it_bseg-bukrs
AND belnr = it_bseg-belnr
AND gjahr = it_bseg-gjahr
AND buzei = it_bseg-buzei
AND blart IN r_blart.
Thanks
Gourisankar.Hi Sankar,
if there are duplicates entries select statement will omit those records. try to include fields in the select statement which makes the selected record different from other atleast by one field.
cheers!! -
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,
RaghavendraHi,
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. -
Select SUM in FOR ALL ENTRIES Select Query
Hi ,
I am using for all entries select statment ,can any one guide me how can i use SUM in the select statment with for all entries .
Regards,
VeeraHi,
THis is not possible using for all entries.
Thanks,
Sriram Ponna. -
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.
Maybe you are looking for
-
Master the new features for editing, adjusting, rendering, and sharing video clips in Lightroom 4. http://adobe.ly/wOuQdl
-
http://ukash-pin.com/ can u explain ?
-
Cannot get next captivate to open when published as a zip
I am currently using Cap 4, but have the trial of Cap 5 as well. I have a 7 mod course and need to be able to open the next Captivate module from the the last slide of the current module. I have inserted a button with a path to the next movie, it wor
-
Windows 8 Adobe Reader XI internal error
Hi, I have created a junction link for a developer user to ensure that the main ssd drive does not become too full. The main Administrator user that does not have a junction link in the user directory, Adobe Reader works fine. The developer user that
-
we can enable or disable an ASM instance on a node using using the following syntax.. can you tell me whether what would be the exact scenario in which we disable the instance.. if we want to remove a node in RAC environment we delete it.. what is th