Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Updating column values based on contents of another

795885Sep 4 2010 — edited Sep 6 2010
I need assistance in creating a procedure that will update a table based on the last character of a column in another table.

For example, say I have the following two tables:

The PersonData table:

PersonID LastName FirstName

1001 Jones Donna
1002 Ervin Roger
1003 Barga David


The PersonTeam table:

PersonID TeamID


1001
1002
1003

What I would like to do is put together a procedure that will grab the last character of the LastName field, then assign a Team ID based on where that letter is in the alphabet. If the letter falls within the first half of the alphabet, I want to insert the value "A" to TeamID column of the PersonID column. If it falls into the last half of the alphabet, I'd like to insert "B" into the TeamID column.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 4 2010
Added on Sep 4 2010
8 comments
2,050 views