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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help in a Loop

Status
Not open for further replies.

AnaFlorTech

Programmer
Feb 21, 2010
15
PT
Hello,

I have a cursor that have the following data that I select from a table:

Phone_number Event_Id
123 1
123 2
123 3
123 4

What I want to do is to increase a number in the event id every time he does the loop.

So in my loop instruction I want to update the table and what I want to see as a final result is:
Phone_number Event_Id
123 2
123 4
123 6
123 7

But I am doing this wrong, because the result appear as following:
Phone_number Event_Id
123 5
123 6
123 7
123 8

Can you help me doing the update instruction, so it can be correct?

Thanks.
 
Hello,

I made a mistake in my final result. What I want to see is:

Phone_number Event_Id
123 2
123 4
123 6
123 8

Thanks
 
I still don't understand what you want. It looks from your second example as if you're just doubling event_id, which you could do as :

update table set event_id = event_id*2

For Oracle-related work, contact me through Linked-In.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top