By arunraj
To append a character at trailing and leading ends of a column value in a database use the following sql statements.
Consider a database table called Employee with one of the column as mobile_number. Suppose if you want to append a character at trailing and leading ends of the mobile_number column use the following sql statements.
UPDATE employee SET mobile_number = mobile_number || '9'
UPDATE employee SET mobile_number = '8' || mobile_number
The above update statements will append '9' and '8' in all the values of the column mobile_number at trailing and leading ends respectively.
To add a character in the middle of a column value use the following statement.
UPDATE employee SET mobile_number = substr(mobile_number, 0, 2) || '9' || substr(mobile_number, 3)
The above statement will insert the character '9' at the third position of all the values in the column mobile_number.