Negative,Positive value check
I have a cursor and
My requirement would be,if the qty which is negative(e.g., -8) in type = 9 is matching the corresponding ve(e.g., 8) quantity in type 10,we need to create a record for type = 10 with +ve quantity in product table
declare
cursor cur_find is
select p.qty,p.id,p.group,p.loc,x.catog
from Product P, Prodline Pr
where and p.type = 9 and p.qty < 0 and p.id = Pr.id and p.qty in (select (-qty) from product where type = 10) ;
begin
for x in cur_find loop
insert into product values (x.id,x.group,-x.qty,10,x.catog); --it has only five columns,and first four fields combined to make primary key
end loop;
commit;
end
I doubt that this part (select (-qty) from product where type = 10) will get the reqd. result? pls help me,is there any best way to implement