INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Nested For Loop update statement (pl/sql)

Nested For Loop update statement (pl/sql)

(OP)
Hi,

Need advise that I need to update number / adding number for one of column by using Nested for loop statement but i have no idea how to write it something like this

SQL> BEGIN
2 FOR i IN 1..2 LOOP
3 FOR j IN 1..4 LOOP
4 DBMS_OUTPUT.PUT_LINE('Outer Loop counter is ' ||
5 i || ' Inner Loop counter is ' || j);
6 END LOOP;
7 END LOOP;
8 END;
9 /

Here is original record

table Purchase

Customer_ID -- Purchase_no -- item_shoe
---1----------------- P001 ---------- Nike
---1----------------- P001 ---------- Addidas
---2----------------- P002 ---------- Puma
---3----------------- P003 ---------- Power
---3----------------- P003 ---------- Cheetah
---3----------------- P003 ---------- New Balance

i need update number like this below

Customer_ID -- Purchase_no -- item_shoe
---1----------------- P001-1 ---------- Nike
---1----------------- P001-2 ---------- Addidas
---2----------------- P002-1 ---------- Puma
---3----------------- P003-1 ---------- Power
---3----------------- P003-2 ---------- Cheetah
---3----------------- P003-3 ---------- New Balance


thanks

RE: Nested For Loop update statement (pl/sql)

(OP)
Hi, PHV

Thanks u so much for ur solution. It works bigsmile

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close