I have a table Lottery
with columns:
- Name
- Ticket_number
I insert x number of names into this table, with the Ticket_number
being NULL
or 0
. Then I want to loop over this table and randomize a number to update Ticket(Ticket_number)
with that number.
I've read about cursors but don't really get it. I also saw something like "while SELECT * FROM Lottery exists, do stuff"
but it requires you to delete rows, as it otherwise would infinite loop, no?
Anyone got any idea?
Cheers, hope it was somewhat clear.