querying db and appending the result back in db

Dear,

I want to search the database based on SMILE query for each compound, based on presence or absence of SMILES, and put the fingerprint generated, back to the database in a seperate column next to the structure. When i did it by reporting it as html, without appending the fps to the database, it took a lot of time for each ccompound.

I am wondering how to optimize it and make it faster? I have uploaded my protocol. Thanks for your input.