oracle - SQL CASE with concatenated columns -
i'm trying locate substring in concatenation of data different columns , return value based on result. i've tried query:
select v_cmr_1.*, t_ricevitori.*, case when contains(v_cmr_1.sp1c || ' ' || v_cmr_1.sp2c || ' ' || v_cmr_1.sp3c || ' ' || v_cmr_1.sp4c || ' ' || v_cmr_1.sp5c, 'gialla') > 0 'gelbe' when contains(v_cmr_1.sp1c || ' ' || v_cmr_1.sp2c || ' ' || v_cmr_1.sp3c || ' ' || v_cmr_1.sp4c || ' ' || v_cmr_1.sp5c, 'rossa') > 0 'rote' end sorte magazzino.v_cmr_1, magazzino.t_ricevitori v_cmr_1.id_ricevitore=t_ricevitori.id_ricevitore , v_cmr_1.id_uscita=:iduscita , v_cmr_1.id_posizione :anno
however i'm getting weird oracle errors (end-of-file on communication channel). ever work?
thanks!
try instr
function instead of contains
select v_cmr_1.*, t_ricevitori.*, case when instr(v_cmr_1.sp1c || ' ' || v_cmr_1.sp2c || ' ' || v_cmr_1.sp3c || ' ' || v_cmr_1.sp4c || ' ' || v_cmr_1.sp5c, 'gialla') > 0 'gelbe' when instr(v_cmr_1.sp1c || ' ' || v_cmr_1.sp2c || ' ' || v_cmr_1.sp3c || ' ' || v_cmr_1.sp4c || ' ' || v_cmr_1.sp5c, 'rossa') > 0 'rote' end sorte magazzino.v_cmr_1, magazzino.t_ricevitori v_cmr_1.id_ricevitore=t_ricevitori.id_ricevitore , v_cmr_1.id_uscita=:iduscita , v_cmr_1.id_posizione :anno
Comments
Post a Comment