dokumentace k produktu Invantivesoučást invantive cloud
Fóra podpory InvantivePřihlásit se/ Zaregistrujte se

REPLACE

Syntaxe

%%{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))

Účel

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

Viz také TRANSLATE a REGEXP_REPLACE.

Parametry:

  • 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.

Příklady

The following example replaces b by z in abc:

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:

select replace('abc', 'b', '', 'c', 'd')

-------------------
ad

The following example leaves the input unchanged since the old text is null:

select replace('abcd', null, 'z')

-------------------
abcd