What is the purpose of Overlay function of PostgreSQL?

 Posted by Niladri.Biswas on 2/7/2013 | Category: PostgreSQL Interview questions | Views: 6588 | Points: 40
Answer:

It's purpose is to replace substring from a specified position to a specified position.

e.g.

Select Overlay('www.dotnetanda.com' Placing 'funda' From 11 For 4) "Overlay Example"

/* Result */

Overlay Example
---------------
www.dotnetfunda.com


As can be figure out that "anda" has been replaced by "funda". The replacement started from position 11 and should continue till 4 since the length of "anda" is 4.So the characters between 11 to 15 (11+4) are "anda" and those should be replaced by "funda".


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response