Oracle - Alias in Case

Asked

Viewed 325 times

-1

How can I put an alias in the column name in a CASE?

CASE atu.cod_situacao_matricula "Alias"
WHEN 2 THEN 'Matriculado'

CASE atu.cod_situacao_matricula as Alias
WHEN 2 THEN 'Matriculado'

Both give error "keyword FROM not located where expected" and does not help nor make sense to put comma

Without the alias the column name comes out inserir a descrição da imagem aqui

1 answer

2


Put the alias after the 'end'

CASE atu.cod_situacao_matricula 
WHEN 2 THEN 'Matriculado'

WHEN 3 THEN 'Outro'
END as Teste
  • Thank you, that’s right

Browser other questions tagged

You are not signed in. Login or sign up in order to post.