Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Oracle SQL Syntax meaning

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?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading