Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7437539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:24:53+00:00 2026-05-29T10:24:53+00:00

For example, I have a table name test_table and has a column named column_A

  • 0

For example, I have a table name test_table and has a column named column_A which has values:

A_1
A_2
A_3
A1
A2
A3
B_1
B_2
B_3
B1
B2
B3

If i want to select all the data has A_ as the beginning, i can use escape \ like:

select * from test_table where column_A like 'A\_*' escape '\';

so that _ not treated as a single character wildcard. i can get A_1, A_2 and A_3.

How should i do when i want use this in Between and operator? like

select * from test_table where column_A between 'A_\*' and 'B_\*' 

i tried the above one, it didn’t escape the _. if i add a escape right after condition like

select * from test_table 
 where column_A between 'A_\*' escape '\' and 'B_\*' escape '\'

or

select * from test_table 
 where column_A between 'A_\*' and 'B_\*' escape '\'

i got a syntax error.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:24:54+00:00Added an answer on May 29, 2026 at 10:24 am

    BETWEEN doesn’t seem to permit escaping of wildcards using that syntax; I assume you’re getting ORA-00933: SQL command not properly ended? (Always useful to actually state the error you’re seeing). It does though allow the alternative syntax:

    select * from test_table
    where column_A between 'A[_]%' and 'B[_]%';
    

    Edit Actually although the syntax is allowed, it isn’t doing anything; BETWEEN isn’t treating _ as a wildcard anyway, though it does treat % as one.

    Edit 2 As @Allan pointed out, it really isn’t treating % as a wildcard, that’s just how the character ordering works.

    I’m not sure that’s what you actually want though, as it will give you A_1, A_2, A_3, B1, B2, B3 (at least with my NLS parameters).

    If what you actually want is A_1, A_2, A_3, B_1, B_2, B_3 then you can use REGEXP_LIKE instead, something like:

    select * from test_table
    where regexp_like(column_A, '^([AB])_';
    

    (though I’ll happily defer to others on the best way to construct that).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For example, I have a table which looks like this : id | name
I have two tables, for example: Table A Table B ======= ======= Name |
For example I have a table. With a field Idnumber. And the field has
I have a table, for example, mytable. It has several columns: col1, col2, col3.
I have a table which defines what things another table can have, for example:
I have a table, has many rows. for example one of from rows(all rows
I have a table, has many rows. for example one of from rows(all rows
I need to update/replace the data in datatable.column. The table has a field named
I have a table in MS Access, which has the following data to be
I have a table similar to: ID...NAME.....HTMLTEXT 1....Footer....`<b>test</b>` where each entry has some HTML

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.