Prevent duplicate data entry [message #275551] |
Sun, 21 October 2007 16:09 |
florida
Messages: 82 Registered: April 2006
|
Member |
|
|
I would like to make sure there are no duplicate record entries in my Oracle 9i table (called MainTable) which has an Id field that is the primary key, City with a varchar data type, Fid and Fid2 are number data types.
Id City Fid Fid2
1 Oakland 34 2
2 Boston 23 34
3 Chicago 25 43
Sometimes someone can enter a duplicate City, Fid and Fid2 and it will end up like this:
Id City Fid Fid2
1 Oakland 34 2
2 Boston 23 34
3 Chicago 25 43
4 Chicago 25 43
What constraints or restrictions can I place on the MainTable where it will never allow a duplicate entry into the table?
I would like to do this somehow in the database. If someone tries to enter a duplicate I should get a error message or something to indicate an attempt to enter duplicate data.
Please advise if this is possible?
[Updated on: Sun, 21 October 2007 16:21] Report message to a moderator
|
|
|
|
|
|