The syntax for the function is INSERT('string1', n, m, 'string2') where …
- 1. string1 is a VARCHAR string in which to insert the new string.
2. n is an INTEGER that represents the starting point for the insertion within string1.
3. m is an INTEGER that represents the number of characters in string1 (if any) that should be replaced by the insertion.
4. string2 is a VARCHAR string to be inserted.
Code: Select all
dbadmin=> SELECT insert('I forgot something', 1, 0, 'Oops...');
insert
---------------------------
Oops...I forgot something
(1 row)
Code: Select all
dbadmin=> SELECT insert('THIS IS A FIXED WIDTH STRING', 11, 12, '');
insert
------------------
THIS IS A STRING
(1 row)
Code: Select all
dbadmin=> SELECT insert('A 3% pay increase is planned for all DBAs', 3, 1, '100');
insert
---------------------------------------------
A 100% pay increase is planned for all DBAs
(1 row)