mardi 23 août 2016

if statement in oracle package

i have different products that uses the following spec table

 ID NO  desccription       MIN      MAX      L       U  
 1  1    p                 0.0       7.5    5.5     8.0 
 2  2    s                 0.0       0.0    93.0    0.0 
 3  3    i                 0.0       2.0    0.0     4.0 

when a new product comes in it compares its self to this table for example if i have the following product details

product 1001 i must be less than 2%
         s must be 93% or greater
         p must be between 5.5 and 7.5

It will take this details compare it to the spec table and get all necessary details related to product 1001 as ff:

if p >= L and p<= p_max and s >= s_L  then
if i >= i_min and i <= i_max then
Select statement goes here

this works fine for product 1001.

But now i have a product 1002 with i must be less than equal to 1%
                               s must be 93% or greater
                               p must be between 6.0 and 8.0

i tried the following

if  p > l and p < p_max  and s >= s_l then
if i < i_max and i = i_min

however this is not getting me the product 1002 it still gets me the product 1001.since both products are similar i am not sure how to go about it

Aucun commentaire:

Enregistrer un commentaire