Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Negative,Positive value check

user12093849Nov 2 2009 — edited Nov 3 2009
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
This post has been answered by Twinkle on Nov 3 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 1 2009
Added on Nov 2 2009
7 comments
1,309 views