If your database has any kind of data type contraints which its 99% likely it does, then your query will fail if your perl statement happens to try to stick a string into a date field, or a number into a bool. This is because hashes do not have a standard internal order, the returned order of
keys or
values is random
**, unless you
sort them. Even then, you can only ever be sure you'll get them in the same order if no keys are added or deleted.
What does
$stmt actaully look like if you
print it out? If you then copy that into your DB query window and execute it, what error(s) do you get? That'll likely reveal the problem.
Update:
Actually, upon re-reading your question, I think you may be having problems due to mis-understanding SQL.
The usual syntax for an UPDATE cmd is:
UPDATE "table_name"
SET column_1 = [value1], column_2 = [value2]
WHERE {condition}
I don't see how you can simplify that down to an
"Update table " . keys %hash . " VALUES " . values $hash kind of structure.
Update:Clarified post thanks to
afoken
** But will return the same order for the same hash if compared within the same Perl 'run' AND the hash has not been modified, thanks
afoken for correcting me.