DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: escaping wildcards

  1. #1
    Join Date
    Nov 2000
    Location
    Birmingham, UK
    Posts
    360

    escaping wildcards

    Got a problem thats driving me nuts and not cant see the wood for the trees! I want to escape any underscores on a table_name:

    set escape "\"

    SQL> select table_name from user_tables
    2 where table_name like 'GE\_%';

    TABLE_NAME
    ------------------------------
    GENEVA_SUMMARY
    GET1
    GE_T1

    Basically I just want to return GE_T1

    Any help appreciated!

  2. #2
    Join Date
    Jan 2003
    Location
    Hull, UK
    Posts
    220
    hey try this

    set escape=\

    select table_name from user_tables
    where table_name like 'GE\_%' ESCAPE '\';

    Srini

  3. #3
    Join Date
    Nov 2000
    Location
    Birmingham, UK
    Posts
    360
    Mmmm - seems to work only if you set escape off -
    SQL> select table_name from user_tables
    2 where table_name like 'GE\_%' escape '\'
    3 ;
    where table_name like 'GE_%' escape ''
    *
    ERROR at line 2:
    ORA-01425: escape character must be character string of length 1


    SQL> set escape off
    SQL> select table_name from user_tables
    2 where table_name like 'GE\_%' escape '\'
    3 ;

    TABLE_NAME
    ------------------------------
    GE_T1

    Really could do with setting it for my SQL*Plus session but thats v much for the work around!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width