Home » Developer & Programmer » Forms » Problem in loop to search values
Problem in loop to search values [message #309693] Fri, 28 March 2008 08:26 Go to next message
asadkhan_2
Messages: 35
Registered: January 2008
Member

I have a problem the scene is
I have two tables in one i have specified all the parameters against products and tests
in the other table i have all of these columns+ a value column also in which when i call i give values against each parmameter and then i m using a function to calculate against these parameters
but the problem is first i have 12 test and 12 functions for calculations now i will write this code 12 times to search the parameter and the value which user will give for that parameter
is there an easy way to solve this
thanks a lot
DECLARE
V_W1 NUMBER;
V_W2 number;
V_W3 number;
V_W4 number;
V_V number;
res number;
No_Rec number;
BEGIN
go_block('PARAMETER1');
Last_Record;
No_Rec:=:System.Cursor_Record;
First_Record;
FOR I in 1..No_Rec loop
If :parameter1.parameter_id = 'w1' then
V_W1:=:value;
elsif :parameter1.parameter_id = 'w2' then
V_W2:=:value;
elsif :parameter1.parameter_id = 'w3' then
V_W3:=:value;
elsif :parameter1.parameter_id = 'w4' then
V_W4:=:value;
elsif :parameter1.parameter_id = 'V' then
V_V:=:value;
end if;

Next_Record;
End Loop;
first_record;
res:=calcul_particular_matter(V_W1,V_W2,V_W3,V_W4,V_V);
:test:=to_char(res,'999999.0000');
Re: Problem in loop to search values [message #309994 is a reply to message #309693] Sun, 30 March 2008 23:00 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Please tell us the problem that you are trying to solve. You MAY have to use dynamix SQL.

David
Re: Problem in loop to search values [message #310029 is a reply to message #309994] Mon, 31 March 2008 00:23 Go to previous messageGo to next message
asadkhan_2
Messages: 35
Registered: January 2008
Member
i have mentioned the problem how can i use dynamic sql for this purpose
ok thanks
Re: Problem in loop to search values [message #310283 is a reply to message #310029] Mon, 31 March 2008 17:52 Go to previous message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
I can only see one function and it is called once you have finished traversing the loop. Your code looks good to me.

David
Previous Topic: how to enter phone no starting with 0..
Next Topic: Application gets closed, leaving a log file in desktop.
Goto Forum:
  


Current Time: Tue Dec 06 00:00:34 CST 2016

Total time taken to generate the page: 0.18271 seconds