0

I am debugging someone's Oracle/Java program that I inherited. I know Oracle fairly well (SQL) but I ran into this sequence which confuses me. I made generic table names but the rest is right:

 select min(latitude), min(longitude) from mytable.myrecord where zip like ? || '%'

Now this is a prepared statement so they set the "?" to "10003" to search for that zipcode in NY. What I don't understand is the "OR" part (||). Doesn't that mean zip is like 10003 or zip is like '%', which would match anything?

3
  • 1
    Evaluates to zip like '10003%', i.e. any zip code starting with 10003. Commented Dec 2, 2021 at 13:09
  • 2
    || does not mean OR. It's the standard symbol for string concatentation. Commented Dec 2, 2021 at 13:13
  • Oh that makes sense. I am used to Java and C programming, where it means OR ;-) Commented Dec 2, 2021 at 13:29

1 Answer 1

2

it is not OR.It is string concatenation https://docs.oracle.com/cd/B19306_01/server.102/b14200/operators003.htm

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.