0
I’m having the following error in trying to use the case clause of a WHERE.
ORA-00905: palavra-chave não encontrada
00905. 00000 - "missing keyword"
*Cause:
*Action:
Erro na linha: 56 Coluna: 39
My query is as follows:
SELECT ST.cod_tpo_solicitacao,
ST.dsc_tpo_solicitacao,
ST.nom_canteiro,
ST.sta_primeiro_tramite,
ST.sta_ativo,
ST.cod_sistema,
ST.cod_grupo,
refs.rv_meaning AS DESC_GRUPO
FROM me_solicitacao_tipos ST
INNER JOIN me_cg_ref_codes REFS ON To_char(ST.cod_grupo) = REFS.rv_low_value
WHERE ( ST.cod_sistema = 'LS' )
AND ( ST.cod_companhia = 'XXXXX' )
AND
(CASE ST.cod_sistema
WHEN 'LS' THEN refs.rv_domain = 'DA_GRP_TPO_SERVICO_LS';
WHEN 'IH' THEN refs.rv_domain = 'DA_GRP_TPO_SERVICO_IH';
WHEN 'CF' THEN refs.rv_domain = 'DA_GRP_TPO_SERVICO_CF';
WHEN 'CA' THEN refs.rv_domain = 'DA_GRP_TPO_SERVICO_CA';
ELSE ' '
END)
ORDER BY cod_tpo_solicitacao, Trim(dsc_tpo_solicitacao);
I’ve made a few dozen changes to the query and some searches and I can’t identify the error.
You put your CASE in the WHERE clause but it seems you forgot the comparison operator. Doesn’t seem to make much sense to me, he shouldn’t be on the selection list?
– anonimo