Perl Monk, Perl Meditation | |
PerlMonks |
Dynamic query generationby chanakya (Friar) |
on May 05, 2005 at 10:19 UTC ( [id://454294]=perlquestion: print w/replies, xml ) | Need Help?? |
chanakya has asked for the wisdom of the Perl Monks concerning the following question:
Greetings! I'm trying to build a query based on a "Action". The Action value comes from a SELECT query. I have a hash which contains the database field names and there equivalent values (These values will be populated by a SELECT query). I want to build a query from this hash based on the "Action" value. For example if the "Action" is "Problem Submit", I'd like a build a query like All the other fields needs to be skipped if the Action is "Problem Submit"(other than Data_id, Prov_id, Provclientid) I'm trying to achieve the same using the code below, but could not get the values while building the query. The reason being, to skip some of the fields I need to traverse the hash using a foreach() loop, once done I've to append the values outside the foreach() loop to the main query. Could anyone throw some light about how to achieve the above said functionality. !!@!! May the force be with you!!
Back to
Seekers of Perl Wisdom
|
|