Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can anybody give a solution for this ???

Status
Not open for further replies.

naresh

Programmer
Oct 9, 2000
9
US
I have a query here which is stored in a table as
which is basically a Ms-Access query
can we write the same in Oracle using the "decode" function

select partno from table_name where
iif(True = True and 104 <= 104 , HP >= 50 * 1.15 / 1.15 and HP_Min <80 * 1.15 / 1.15,
iif(False = False and 107 > 104 and 149 <= 149, HP >=50 * 1.15 / 1.15 and
HP_Min <80 * 1.15 / 1.15 , iif(False = False and 104 <= 104,
HP >= 50/1 and HP_Min <80/1 ,
&quot;&quot;)))


explaination or the Pseudocode:

select partno from table_name where

if True=True and 104<=104 then
HP >= (50 * 1.15 / 1.15) and HP_Min < (80 * 1.15 / 1.15) ;
elseif False = False and 107 > 104 and 149 <= 149 then
HP >=50 * 1.15 / 1.15 and HP_Min <80 * 1.15 / 1.15 ;
elseif False = False and 104 <= 104 then
HP >= 50/1 and HP_Min <80/1;
else
null;
end if;

note : HP , HP_Min is the field name of the table
[sig][/sig]
 
Hi Naresh,

Weird query <grin>

Could you explain what the &quot;[tt]elseif False = False and 104 <= 104[/tt]&quot; stuff is about?

It seems to me that a test like that will always be true... [sig][/sig]
 
Hi,

elseif
False = False and 104 <= 104

in this stuff the First &quot;False&quot; is a variable value which is substituted at Runtime
it may be either &quot;True&quot; or &quot;False&quot;

same with the First &quot;104&quot; stuff also it may be either 104 or any other integer which picks the variable value at Runtime.

any solutions please reply
Thanx in advance
Naresh [sig][/sig]
 
How about a where clause?

where (True=True and 104<=104) AND
( HP >= (50 * 1.15 / 1.15) and HP_Min < (80 * 1.15 / 1.15)) OR
( False = False and 107 > 104 and 149 <= 149) AND
( HP >=50 * 1.15 / 1.15 and HP_Min <80 * 1.15 / 1.15)
OR
( False = False and 104 <= 104 ) AND
( HP >= 50/1 and HP_Min <80/1) ;

Obviously didn't try this, let us know.......

[sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top