Saturday, 15 August 2015

sql - how to detect in case statement if the value of the field is a string "0" in oracle? -



sql - how to detect in case statement if the value of the field is a string "0" in oracle? -

in oracle, how observe in case statement if value of field in "0", set ""? because have problem detecting when utilize this

case when regexp_like (ctyid, '^[:digit]') '""'

it doesn't work, still getting "0" in output..i want set ""

if want 0 anywhere in string, utilize like operator :

when ctyid '%0%' null

that homecoming null value if 0 found anywhere in string.

if want value 0 itself, utilize = operator.

when ctyid = '0' null

case looks easier read, same look written decode :

decode(cytid, '0', null, cytid)

sql oracle

No comments:

Post a Comment