Replaces all occurrences of a specified string value with another string value. (REPLACE in Transact-SQL).
REPLACE ( string_expression , string_pattern , string_replacement )
String.replace( pattern, new_expression)
Code:
SELECT REPLACE('Real computer software', 'software','science') AS COLUMNNAME;
Output:
COLUMNNAME |
---------------------+
Real computer science|
Code:
SELECT REPLACE('Real computer software', 'software','science') AS COLUMNNAME;
Output:
COLUMNNAME |
---------------------+
Real computer science|
Code:
CREATE OR REPLACE FUNCTION REPLACER (str varchar, pattern varchar, new_expression varchar)
RETURNS string
LANGUAGE JAVASCRIPT
AS
$$
return STR.replace( PATTERN, NEW_EXPRESSION );
$$;
SELECT REPLACER('Real computer software', 'software', 'science') AS COLUMNNAME;
Output:
COLUMNNAME |
---------------------+
Real computer science|
No issues were found.
No related EWIs.