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

update a column of type char9

Status
Not open for further replies.

LongHorn

Programmer
Jun 20, 2001
30
US
Hi, How do I update the field's value that has type char(10)?
For instance I want to change the value from 4535 to 4535AR.
I tried update nsr_pmt set pmt_id = pmt_id + 'AR' , but I got an error.
Thanks,
Longhorn
 
CHAR columns are fixed length, so they are right padded with blanks. If you concatenate '4535 ' with 'AB' you will produce '4535 AB', which is too long to fit in your column.

To avoid this problem use the RTRIM function to remove trailing blanks. Your update becomes

update nsr_pmt set pmt_id = rtrim(pmt_id) || 'AR';

Please note also that the concatenation operator in Oracle is ||, not +. That would also have generated an error.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top