in reply to Re: Perl - DBI - How to process array rather than single value?
in thread Perl - DBI - How to process array rather than single value?
Considering the query uses '?', i assume it is a placeholder. It seems that he is executing the query with a single value a number of times, and after each run he does something with the returned values.
Afterward, he has an array of IDs @queryIDs. He wants to execute the the same query (and gather the results in order) for the values in the array.
This is actually a SQL question, and the answer is, it depends. The quick and dirty (and insecure) method is to join the array with commas and build a dynamic SQL statement with IN().
To do the same securely, would require splitting the list in SQL, which depends on the RDBMS and version. For example, Oracle 11r2 has a good tokenization method via XMLDB which can be found with a simple search.
|
|---|