Teradata SQL - Use OREPLACE to Replace or Remove Characters

access_time 8 months ago visibility1093 comment 0

OREPLACE functions in Teradata can be used to replace or remove characters from a string. OREPACE is Teradata's extension to ASNI SQL. The usual REPLACE function is not available.


REPLACE function is commonly implemented in many other SQL databases such as SQL Server, MySQL, BigQuery, Oracle, etc.

The syntax is:

REPLACE(original_value, from_value, to_value)

For example, the following code snippet replaces word 'Context' with 'Kontext'.

SELECT REPLACE('Context is a great data engineering website.', 'Context', 'Kontext')

Teradata OREPLACE function

In Teradata, the equivalent function is OREPLACE and the syntax looks like this:

REPLACE(source_string, search_string, replace_string)

* replace_string is optional. This function replaces every occurrence of search_string in the source_string with the replace_string. Use this function either to replace or remove portions of a string.

When replace_string is not specified, it will remove search_string from source_string.


SELECT OREPLACE('Context is a great data engineering website.', 'Context', 'Kontext')

info Last modified by Administrator at 2 months ago copyright This page is subject to Site terms.
Like this article?
Share on

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

Kontext Column

Created for everyone to publish data, programming and cloud related articles.
Follow three steps to create your columns.

Learn more arrow_forward

More from Kontext

local_offer teradata local_offer SQL

visibility 44
thumb_up 0
access_time 2 months ago

This article demonstrates how to create volatile table in a Teradata procedure, perform DML actions (INSERT, DELETE, UPDATE) against it and then return the result set dynamically from the temporary table in the procedure.

local_offer teradata local_offer teradata-tool

visibility 9046
thumb_up 0
access_time 6 years ago

In my previous posts about Querying Teradata and SQL Server, I logged into the virtual machine graphic interface to manage the database. However, I constantly found it is resource intensive as there is only 4GB memory in my laptop. Instead, I will use text mode to start the virtual machine and ...

local_offer hive local_offer SQL local_offer hive-sql-ddl

visibility 21
thumb_up 0
access_time 3 months ago

This page shows how to create, drop, alter and use Hive databases via Hive SQL (HQL). CREATE (DATABASE|SCHEMA) [IF NOT EXISTS] database_name [COMMENT database_comment] [LOCATION hdfs_path] [MANAGEDLOCATION hdfs_path] [WITH DBPROPERTIES (property_name=property_value, ...)]; LOCATION is ...

About column

Code snippets and tips for various programming languages/frameworks.

rss_feed Subscribe RSS