Flowers To India

Flowers To India
Send cakes,flowers to India

Tuesday, June 19, 2012

How to select special character(like _ ) tables in Oracle


Example SQL query :
select table_name from dba_tables where owner='ownername' AND table_name like '%\_%' escape '\'

One more example
where ksppinm like '%\_io\_%' ESCAPE '\';

Oracle Escape Characters
Oracle allows the assignment of special escape characters to tell Oracle that the character is interpreted literally.  Certain characters such as the underscore “_” are not interpreted literally because they have special meaning within Oracle.
So we have to use escape command for selecting the special character tables like _

example for escape command
Example
select table_name from dba_tables where owner='ownername' AND table_name like '%\_%'escape '\'
One more example
where ksppinm like '%\_io\_%' ESCAPE '\';


No comments: