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

Use SQL to add ZZZ to surname 1

Status
Not open for further replies.

AyJayEL

Technical User
Jan 30, 2001
425
GB
I have a table called Student. Two fields called NCY (number) and surname (char). I want to add ZZZ to the start of the field Surname when the NCY = 99.

So the field STUDENT.Surname = Bloggs will become ZZZBloggs if he has NCY = 99.

Can you help me with the commands for this?

I have an Oracle 10g database and I'm using SQL Plus.

Learn something new every day
Using Crystal 8, Oracle Database Paint Shop Pro X2 Nikon D80 Fuji S5
 
Do you want to actually change the row in the table, or is this simply for display?
Either way, you will be looking to concatenate, for which Oracle used the Double Pipe (||) ([shift]+\)

'anysetofcharacters'||'anothersetofcharacters'=
'anysetofcharactersanothersetofcharacters'
 
I want to change the row.

Learn something new every day
Using Crystal 8, Oracle Database Paint Shop Pro X2 Nikon D80 Fuji S5
 
update student set surname = 'ZZZ'||surname
where NCY = 99
 
Thank you Dagon. That worked perfectly. :) A Star for you.

Learn something new every day
Using Crystal 8, Oracle Database Paint Shop Pro X2 Nikon D80 Fuji S5
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top