Skip to content

Instantly share code, notes, and snippets.

@leandrogilvalle
Last active May 22, 2017 14:20
Show Gist options
  • Select an option

  • Save leandrogilvalle/d6de776ecb82ccd6308dc3ba3ce1e26a to your computer and use it in GitHub Desktop.

Select an option

Save leandrogilvalle/d6de776ecb82ccd6308dc3ba3ce1e26a to your computer and use it in GitHub Desktop.
PLSQL Oracle - Função Regex
with separador_chaves as (
select regexp_substr(&p_valor,'[^;]+', 1, level) as chaves_e_valores
from dual
connect by regexp_substr(&p_valor,'[^;]+', 1, level) is not null
),
valores_por_chaves as (
select substr(chaves_e_valores,instr(chaves_e_valores,'#')+1) as valor
from separador_chaves
where instr(chaves_e_valores,&p_chaves) > 0
)
select valor into v_retorno
from valores_por_chaves;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment