LIKE and ESCAPE problem
Date: 3 Apr 2002 08:39:57 -0800
Message-ID: <d926f6f0.0204030839.5b0e499d_at_posting.google.com>
[Quoted] I must be doing something wrong, but I'll be darned if I can figure it out.
What I want to do is test whether a string ends with the literal value '_d' - so I'm using the LIKE operator with ESCAPE as follows:
declare
v_dummy VARCHAR2(20);
begin
v_dummy := 'ABC_d';
IF v_dummy LIKE '%/_d' ESCAPE '/' THEN
dbms_output.put_line('Yep');
ELSE
dbms_output.put_line('Nope');
END IF;
end;
Even though v_dummy truly does end with '_d', I always get "Nope" as the DBMS output.
Note that if I change the like clause to read
LIKE '%C/_d' ESCAPE '/'
then I get "Yep" as my DBMS output. There's something about escaping after a wildcard that's causing a problem.
Running this under Oracle 8i, v8.1.6
Any hints would be appreciated - direct e-mail replies especially.
Thanks
-Marty
martyt_at_pobox.com
Received on Wed Apr 03 2002 - 18:39:57 CEST