Question

I have already searched the internet what is the logic in oracle when using a between function in string but couldn't seem to find or understand it.

For example.

 select 1 from dual
 where 'M9W'  between  'M9W0A0' and 'M9W9Z9'

Why would the above query would not return a row?

Can someone please explain?

Thank you very much.

Was it helpful?

Solution

String comparison is based on alphabetical order. The string M9W is not alphabetically between M9W0A0 and M9W9Z9. Alphabetically, it comes before both. Alphabetically, it comes before any string M9W<<any character(s) here>>.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top