PostgreSQL ARRAY_REPLACE() function
ARRAY_REPLACE() function
This function is used to replace each array element equal to the given value with a new value.
Syntax:
array_replace(anyarray, anyelement, anyelement)
Return Type:
anyarray
PostgreSQL Version: 9.3
Example: PostgreSQL ARRAY_REPLACE() function
Code:
SELECT array_replace(ARRAY[1,2,5,4], 5, 3);
Sample Output:
array_replace --------------- {1,2,3,4} (1 row)
Previous: ARRAY_REMOVE function
Next: ARRAY_TO_STRING function
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework