Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Replacing name with first character in the DB

 
vernon mweetwa
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

i am trying to write a program that will query the database and thereafter update all the firstnames of the clients in the database to the first character of the firatname e.g a name in the database like vernon should now be v.this kind of a program should iterate through all the names in that database and update them accordingly.

what i need is the logic that will make the program to go to the first record of the database,check the firstname and update it,then move on to the next record,do the same until it reaches the last record.

waiting to hear from you soon.

[Bear edit: removed shouting from subject line; please note that you will find the caps lock key to the left of the A key]
[ January 17, 2005: Message edited by: Bear Bibeault ]
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like something with a database only solution, so I'm moving it to the JDBC forum.

Dave
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64699
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
waiting to hear from you soon.


You're unlikely to hear much with this type of question.

You'd get much better response by posting what work you have done so far, and asking questions about the aspects of it that are giving you trouble. You are unlikely to find someone willing to just write all the code for you.
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following won't take the steps that you asked for (query, select names, iterate row-by-row, etc), but it has the same effect in the end. Oh, and it's Oracle-specific.Also, the second 1 in the substr call may need to be 2 if the end index is exclusive. I don't remember of the top of my head.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic