mardi 4 août 2015

is it possible to store ResultSet from a query into an array and use the array as search parameters for an SQL query

i have two tables WorkSkillsPlanning(WSP) and TrainingAchieved(TA). WSP hold a list of planed training and targeted number of people to be trained e.g. ISOO:90001 10 people while TA holds the actual number of people trained as well as the actual course done. Since WSP and TA are dynamic in the sense that the data they hold is not static neither is known as training plans can change is it possible to run an intersect query on these table to find similarities i.e a course in WSP which has actually be done and recorded in TA. Store the results of the intersect query in an array e.g. MyArrayList{ISO,COMMUNICATION) these being values present in both table and use MyArrayList values to run count queries on TA to establish the number of people who would have done the course i.e ISO and COMMUNICATION and use the resultant to subtract from WSP (ISO,COMMUNICATION).

here is an example, first part

"Select QUALIFICATIONGROUP from  APP.WSP intersect select COURSEBOOKED from APP.BOOKCOURSE"

which results in ISO and COMMUNICATION which i want to store in an ARRAY or variable.

second part

select count(COURSEBOOKED) from APP.BOOKCOURSE where COURSEBOOKED = Variable1
 rs.getString(Count(COURSEBOOKED))
 value returned == 5

re do the process again for COMMUNICATION and any other course in the array, of which after use the values returned from the count query to subtract to subtract WSP total minus TA total.

I hope this makes sense

Aucun commentaire:

Enregistrer un commentaire