Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Argue
Sep 29, 2005

I represent the Philippines
I'm using Oracle. What's the best way to do something similar to WHERE name IN (a set of values), except instead of checking for equality, we use the LIKE keyword? It would end up being functionally the same as WHERE name LIKE val1 OR name LIKE val2 OR name LIKE val3, except the number of right hand values can change. Currently, what I'm doing is pre-preparing the SQL by iterating over the list of possible names (which are not retrieved from the DB) and appending "OR name LIKE ?" each time.

Adbot
ADBOT LOVES YOU

Argue
Sep 29, 2005

I represent the Philippines

minato posted:

Perhaps you can build a more general Perl-compatible regex, and that'll only use 1 statement? E.g.:

Ah, great. That sounds cleaner than mine; the sets I'm expecting aren't all that large so it shouldn't waste too much time. Thanks.

Argue
Sep 29, 2005

I represent the Philippines

fletcher posted:

What does the INNER do? What happens if you take it out?

The inner join is a type of join, and as far as I know, the default one used when you omit the inner. It just matches each row in the first table against each in the second. You would use other kinds of joins for the cases not covered by inner joins--for instance, if you had a table of books, and its foreign key to the authors table for some reason points to a nonexistent row, you could use an outer join to list each book next to either its author's name or some string like "NULL" if the author doesn't exist. An inner join would miss this case; there's an example in that link I gave you.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply