I have a query where I am using regex_like, and I need more than one parameter, something like this:
WHERE regexp_like (FILENAME,'_G_',) or (FILENAME,'_Z_',) or (FILENAME,'_M_',)
Thanks in advance
You can use the following regexp:
regexp_like (FILENAME,'.{1}[GZM]{1}.{1}')
. (dot) represents any character {1} represents only 1 character is allowed for the preceding pattern.Cheers!!
{1} quantifier here, it is implicit when not specified. Also, '_' (a litteral underscore) and . (any character) are two different things._ and . but I think OP is comparing LIKE and REGEXP_LIKE. In LIKE underscore _ means any character so I used .If you want to add two or more different parameters, that do not have a lots in common, then you can use | to separate them like this:
select *
from table_name
WHERE regexp_like (FILENAME,'_G_|-kk_|-AH-');
Here is a small DEMO
Do not know what exactly you want when you ask to "order by it" but try this:
select id, filename
from table_name
WHERE regexp_like (FILENAME,'_G_|-kk_|-AH-')
order by filename
like, butregexp_likelets you use a regular expression which is a more flexible type of search pattern.