Utilizar un LIKE dentro de un DECODE

Para comparar dentro de un DECODE con parte de un texto del contenido de un campo, es decir, para poder utilizar un like u otras funciones en lugar de la igualdad que toma por defecto el DECODE se puede hacer lo siguiente:

Select
decode(CAMPO, (select CAMPO from dual where CAMPO like 'A%'), 'Campo comienza por A',
(select name from dual where name like 'B%'), 'Campo comienza por B',
'Campo no comienza ni por A ni por B')
From TABLA;

Reply

The content of this field is kept private and will not be shown publicly.
  • Lines and paragraphs break automatically.
  • Links to specified hosts will have a rel="nofollow" added to them.

  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.

Find with Google engine

Google