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

Update table

Status
Not open for further replies.

ELG

Programmer
Aug 22, 2000
3
US
I am new to Oracle, so I don't know how to do this update. I need to update data(grade, name, etc.) in a table that has ssn as a unique key, with a newer version of the data with the same ssn's. Does this require PL/SQL? Any help would be greatly appreciated.
 
No, you can do this with straight sql:

UPDATE my_table
SET col1 = 'New Col1 Value',
col2= 75
WHERE SSN = 1234567890;

Also, don't forget to commit your transaction after your updates are done; otherwise, they may get undone.

A final note - SSNs are a poor choice for unique identifiers; they are notorious for not being truly unique!
 
Carp,

I thought developers were getting away from SSN's because of privacy, not because they may not be unique? I always thought that one SSN went to one person. Terry M. Hoey
th3856@txmail.sbc.com

Ever notice that by the time that you realize that you ran a truncate script on the wrong instance, it is too late to stop it?
 
Yes, the Privacy Act is just one more problem associated w/ SSNs, but there are plenty of situations where people want them in the table anyway.
Theroetically, there is only one per person, but with 9 digits, 3 of which have geographic encoding, you can see where the government will run out of unique numbers pretty quickly, especially since some numbers (000-00-0000, 123-45-6789, etc) will not be used.

This is why you hear news stories about people who want to check on their Social Security benefit and find out that they've been dead for several years!

The situation is further complicated when you have the possibility of foreign nationals who have no SSN; now you have to dummy up a unique identifier for them!
 
I am working with 40,000 record tables. I don't want to do them individually. I do know that the SSN's are unique.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top