LIKE & Escape character

I want to find the column names having underscore ‘_’ i wrote the following query :-

select * from dba_tab_cols where column_name like '%_%';

but it return all the column names.

For time being i thought oracle went crazy but underscore ‘_’ means different things in the oracle.isn’t it. Now what about my problem. For this kind of problem we need to use escape character in LIKE operator. For ex:-

select * from dba_tab_cols where column_name like '%i_%' escape 'i';

and it’s working as expected.  Instead of ‘i’ you can use anything. But if you

More information is about LIKE operator is here and here.

Advertisements

Published by

Anirban

I am software engineer by profession. Sometimes i post some topics about technology and some other topics which i find out interesting. My hobbies include watching movies,music, reading books(both technical and story books(fiction only)).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s