Others have pointed out the problem with your DBI code. I just wanted to point out that you might be able to improve things by putting all of these dictionaries in one table and making a column called DICTIONARY_ID which would be a part of the primary key. That would allow you to use a single SQL statement with placeholders.