Saturday, January 6, 2018

oracle sql how to select column with string containing underscore

oracle sql how to select column with string containing underscore


underscore ( _ ) is a wildcard in oracle sql, so to get results of a row with a column containing a string with a literal underscore "wildcard" in it:
X_AGR_234253

you need to escape the underscore with a backslash ( ):
select * from my_table where my_column like X_AGR%

the underscore in an "sql select like" statement is like the regex period/full-stop wildcard ( . )

thanks to don:
http://www.dba-oracle.com/t_special_characters_like_sql_query.htm

visit link download