---
title: "REPLACE"
description: "The REPLACE SQL function changes a given text by replacing all occurrences from an ordered list of texts by their associated replacement texts."
language: ja
source_language: en
translation_state: pending
canonical: https://documentation.invantive.eu/ja/docs/invantive-universalsql/grammar/sql-functions/replace
original: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/sql-functions/replace
updated: 2026-12-04T14:09:48Z
license: https://documentation.invantive.eu/ja/
---

## 構文
```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> REPLACE[REPLACE]:::quoted
    REPLACE --> End((END))
```

## 目的
The `REPLACE` SQL function changes a given text by replacing all occurrences from an ordered list of texts by their associated replacement texts.

関連項目：[[TRANSLATE]]および[[REGEXP_REPLACE]]。

パラメータ:
- Input (`varchar2`): the text to change.
- Old text 1 (`varchar2`): the text to be replaced.
- New text 1 (`varchar2`): the replacement text.
- Old text n (optional, `varchar2`): additional texts to be replaced.
- New text n (optional, `varchar2`): additional replacement texts.

Returns: A text with all old texts replaced by their new text in the order they occur in the list.

## 例
The following example replaces `b` by `z` in `abc`:
```sql
select replace('abc', 'b', 'z')

-------------------
azc
```
The following example removes `b` from `abc` by replacing it with an empty text, and replaces `c` by `d`:
```sql
select replace('abc', 'b', '', 'c', 'd')

-------------------
ad
```
The following example leaves the input unchanged since the old text is `null`:
```sql
select replace('abcd', null, 'z')

-------------------
abcd
```

