SQAPL: "elastic" binding?

Using (or providing) components based on the "Win32" framework

SQAPL: "elastic" binding?

Postby MBaas on Sat Jul 11, 2015 1:00 pm

I'd like to do a SELECT using an IN-Filter with an variable number of elements. Is there an elegant way to data-bind vector into that statement?

In other words: I'd like to get (vals ∊ krit)/id for any ⍴ of krit - in SQL, and for safety-reasons I'd like to use databinding: 'SELECT id FROM table WHERE vals IN (:{???}:)' and have the elements of krit inserted. Is there a way to do this???
User avatar
MBaas
 
Posts: 156
Joined: Thu Oct 16, 2008 1:17 am
Location: Gründau / Germany

Re: SQAPL: "elastic" binding?

Postby Morten|Dyalog on Mon Jul 13, 2015 8:08 pm

I'm afraid that I don't think there really *is* a good / elegant solution. You could perhaps prepare a statement with some number of bind variables (say 25) and then use it repeatedly. Other strategies, depending on your data, would be to compute a some paris of maximum/minimum values, select all records between them and do the final filtering in APL.

Finally, insert the values into a temporary table using "bulk input" and join with it? :-)
User avatar
Morten|Dyalog
 
Posts: 453
Joined: Tue Sep 09, 2008 3:52 pm


Return to Windows: GUI, COM/OLE/ActiveX

Who is online

Users browsing this forum: No registered users and 1 guest