I want to show the display values in the column, but the column is a string with entries like '1:3', '2', '1:2:4', which are the return values based on a LOV with static values.
If I set the column as "Display text (Based on LOV)" it will only work for those entries with one number only, like '3' or '1'.
I thought of normalizing the table, but then I would have a multi table form. This should be simple, yet I cannot figure out how to do this?
select p.COD,
UNIDADE_PROPONENTE,
CAUSA_FUND,
CAUSAS_RELAC,
TITULO,
DESC_SOLUC,
listagg(a.acao, ';<br><br>') within group (order by null) as "a.acao",
OUTRA_ACAO,
SUGESTAO,
SITUACAO
from TB_PROPOSTA p, TB_ACAO a,
table(cast(multiset(select level from dual
connect by level <=regexp_count(p.acao,':') + 1)
as sys.odcinumberlist)) x
where
a.cod = regexp_substr(p.acao, '[^:]+', 1, x.column_value)
and
(:P2_XUNIDADE_RESPONSAVEL = UNIDADE_PROPONENTE OR :P2_XUNIDADE_RESPONSAVEL IS NULL)
and
(INSTR(':'|| p.acao ||':', ':' || :P2_XACAO || ':') > 0 OR :P2_XACAO IS NULL)
group by p.cod, p.acao, unidade_proponente, causa_fund, causas_relac, titulo, desc_soluc, outra_acao, sugestao, situacao
order by p.cod, p.acao;
edit: Now I either get missing keyword error or sql command not properly ended. This one gives SQL COMMAND NOT PROPERLY ENDED
select p.COD,
UNIDADE_PROPONENTE,
CAUSA_FUND,
CAUSAS_RELAC,
TITULO,
DESC_SOLUC,
listagg(a.acao, ';<br><br>') within group (order by null) as "a.acao",
OUTRA_ACAO,
SUGESTAO,
SITUACAO
from TB_PROPOSTA p
cross join table(cast(multiset(select level from dual
connect by level <=regexp_count(p.acao,':') + 1)
as sys.odcinumberlist)) x
left join TB_ACAO.ACAO
on TB_ACAO.COD = regexp_substr(TB_PROPOSTA.ACAO, '[^:]+', 1, x.column_value)
where
(:P2_XUNIDADE_RESPONSAVEL )= UNIDADE_PROPONENTE OR :P2_XUNIDADE_RESPONSAVEL IS NULL)
AND
(:P2_XACAO IN (p.ACAO) OR :P2_XACAO IS NULL)
group by p.cod, p.acao, unidade_proponente, causa_fund, causas_relac, titulo, desc_soluc, outra_acao, sugestao, situacao
order by p.cod, p.acao;
And if I change the "cross join" to only "join" I get the "Missing keyword (ORA-06550: line 17, column 1: ORA-00905: missing keyword) right before the "where"