‎2006 Feb 09 9:39 AM
Hi experts,
Iam selecting data from 10 tables and putting into itab.
I have filtered lot of data from this itab and got required data.
Then i want to select the the data from itab by parameters.I want to know is it correct way....!Or is there any way to approach.
code something like this.
loop at t_equp where vkbur = <b>p_vkbur</b> and
kunum = <b>p_kunum</b> and
exp_mth_name = <b>p_month</b> and
kdgrp = <b>p_kdgrp.</b>
doing something
endloop.
‎2006 Feb 09 9:43 AM
‎2006 Feb 09 9:44 AM
‎2006 Feb 09 9:46 AM
Hi,
1. Always try to restrict yout data while Select itself.
It will reduse the hits of DB.
In your case I think you selected all the records from DB and later you are restricting them. Why dont you do this at Select itself.
Thanks.
If this helps you reward with points.
Message was edited by: KDeepak
‎2006 Feb 09 9:53 AM
Hi Kaki,
are all these are parameters or is there any select option.
loop at t_equp where vkbur = p_vkbur and
kunum = p_kunum and
exp_mth_name = p_month and
kdgrp = p_kdgrp.
"doing something
endloop.regards
vijay
‎2006 Feb 09 10:00 AM
Hi Kaki,
It is syntactically correct but it is not the right way to get the data which increases the burden on the database b'coz u r selecting the total data and later u start filtering instead of this just use the condition in the select statement itself.
regards,
<b>Sri</b>.
‎2006 Feb 09 10:34 AM
Hi,
SInce you are selecting the t_equp data from 10 tables, I hope the vkbur,kunum,exp_mth_name and kdgrp will exist in some tables.
So it is always better,if you are restricitng while selecting from database itself.
For ex..
select * from db1 into itab1 where vkbur = p_vkbur.
select * from db2 into itab2 where kunum = p_kunum.
Then after you do some manipulations,you will populate t_equp which will have only the restricted value.
‎2006 Feb 09 10:38 AM
Nothing wrong in writing like this.
But If U have already selected data from SELECTS based
on the parameters then this is not required.
Better to filter the data at the SELECT statement only.
‎2006 Feb 09 3:05 PM
You can do it this way, but it would be far more efficient to do a binary search.
Rob