I would like some help. I have the following query below, however, I need in the column DE to bring only the texts after the word "Exclusion", and in column PARA only bring the text from the word "Inclusion". However, today, he is bringing the whole text and I need only what comes "Exclusion: XXXXXXX" and "Inclusion: YYYYY".
You are loading the entire line and it is not respecting the limit that was created.
Code:
SELECT
"DATA",
CONTRATO,
TIPO_CONTRATO,
STATUS_CONTRATO,
MODALIDADE_FATURAMENTO,
PROMOCAO,
SUBSTR(observacao,INI) AS DE,
SUBSTR(observacao2,LM) AS PARA,
LOGIN,
USUARIO,
AREA
FROM
(SELECT
BASE.*,
INSTR(observacao2,' Inclusão: ',1) as LM,
INSTR(observacao2, ' Exclusão: ',1) as ini
FROM
(
SELECT
"ID",
A."DATA",
A.CONTRATO,
NUMERO_CONTRATO,
ACAO,
DESCRICAO_ACAO,
OBSERVACAO,
NUMERO_PROTOCOLO,
LOGIN,
USUARIO,
A.AREA,
B.PROMOCAO,
TIPO_CONTRATO,
STATUS_CONTRATO,
MODALIDADE_FATURAMENTO,
replace (replace(a.OBSERVACAO,'Inclusão:',' Inclusão:'),'Exclusão:',' Exclusão: ') as observacao2
from DBMDTH.vm_dth_notas_contrato A, DBMDTH.VM_DTH_USUARIO_APLICA_PROMOCAO B, DBMDTH.VM_DBM_CONTRATO E where A."DATA" BETWEEN '01/07/18' and '31/07/18'
Can you help?