selecting records with "%"

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aravicha
    New Member
    • Oct 2007
    • 4

    selecting records with "%"

    Hi i have a column which has % in it, i want to know how i can use this in IF LOOP inside a procedure...
    value is "ARAV%"

    i wanna check like this,
    if value like '%%'
    but it does not work... please help asap
  • Dave44
    New Member
    • Feb 2007
    • 153

    #2
    Originally posted by aravicha
    Hi i have a column which has % in it, i want to know how i can use this in IF LOOP inside a procedure...
    value is "ARAV%"

    i wanna check like this,
    if value like '%%'
    but it does not work... please help asap
    having the % in the string messes up the wildcards...
    what about doing a replace on them like this:

    Code:
    [145]dave@> create table t (a varchar2(30));
    
    Table created.
    
    Elapsed: 00:00:00.00
    [145]dave@> 
    [145]dave@> insert into t values ('hello %ter');
    
    1 row created.
    
    Elapsed: 00:00:00.00
    [145]dave@> 
    [145]dave@> insert into t values ('water');
    
    1 row created.
    
    Elapsed: 00:00:00.01
    [145]dave@> 
    [145]dave@> select * From t where replace(a,'%','qqq') like '%qqq%';
    
    A
    ------------------------------
    hello %ter
    
    Elapsed: 00:00:00.01

    Comment

    • debasisdas
      Recognized Expert Expert
      • Dec 2006
      • 8119

      #3
      Just try to use this sample

      [code=oracle]select * from table_name where field_name like '%\%' escape '\' [/code]

      Comment

      Working...