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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.