pl sql . pattern matching problem

hi everyone
i am facing a strange problem

declare
 v_var number(10);
 begin
if( regexp_like('RCDORMS_MMS_*_DAR','RCDORMS_MMS_*_DAR'))
then
v_var:=20;


dbms_output.put_line(v_var);
end if;
end;
/

please tell me what's the wrong thing in this expression..
as i am not able to get any output

Nothing strange about it really.
You don't see any output because your regular expression "RCDORMS_MMS__DAR" does not match your literal string "RCDORMS_MMS__DAR".
What you are saying by your regular expression is this:

/RCDORMS_MMS_*_DAR/
 
Match any string that has
 
(1)  "R" : the character "R", followed by
(2)  "C" : the character "C", followed by
(3)  "D" : the character "D", followed by
(4)  "O" : the character "O", followed by
(5)  "R" : the character "R", followed by
(6)  "M" : the character "M", followed by
(7)  "S" : the character "S", followed by
(8)  "_" : the character "_", followed by
(9)  "M" : the character "M", followed by
(10) "M" : the character "M", followed by
(11) "S" : the character "S", followed by
(12) "_*" : zero or more occurrences of the character "_", followed by
(13) "_" : the character "_", followed by
(14) "D" : the character "D", followed by
(15) "A" : the character "A", followed by
(16) "R" :the character "R", followed by

Now, if you look at your literal string, you'll see that the match fails at step # 13.

The step # 12 succeeded, because you have ONE occurrence of the character "_" which makes the phrase "zero or more occurrences" TRUE.

But it (i.e. the character "_") is **NOT** followed by an underscore as required by the regex.

It is followed by a literal asterisk character ("*").

Hence the regex fails to match your string and you see no output.

Note that the asterisk ("*") is a "metacharacter" in POSIX BRE, i.e. it has a special meaning in a regex; you cannot use its literal meaning. Also note that Oracle follows POSIX specification for regular expressions.

HTH,
tyler_durden