Doubt in sql [message #85582] |
Sat, 10 July 2004 06:32 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
pratyusha
Messages: 8 Registered: July 2004
|
Junior Member |
|
|
how can we write a sql query to achive the below result :
Assume that there is a table which is beig used by multiple clients and in this table there are null records and when any user tries to insert a record then it should insert the record in the first null record from the begining and if more than 1 user tries to insert then 1st user - 1st null rec,2nd user - 2nd null rec.....
|
|
|
Re: Doubt in sql [message #85586 is a reply to message #85582] |
Sat, 10 July 2004 23:09 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
Do you mean that you already inserted records with all empty columns, and that the inserts of the users should fill these records ?
This is a very very baaaad idea. It will force the database to only serve 1 person at a time:
Suppose I am user 1.
I do an insert on your table. This should be translated into an update of record 1. Now, before issuing a commit, I go for a cup of coffee.
Now you come along (user 2). You want to do an insert on this table too. You cannot see my insert, because I didn't commit yet.
So, you will go for record 1 as well. Solution: lock the entire table when a user tries to insert.
Problem: I am chatting at the coffee-machine, while you are pulling your hair out because you have a deadline to meet.
Ultimate solution:
Just do the insert. Let the database do what it's good at.
Why do you want to do this ? There must be another solution.
If I misunderstood what you meant, then ignore this post ;)
hth
|
|
|