XP is just a number | |
PerlMonks |
SQL::Abstract with non SQL source databy Anonymous Monk |
on Mar 10, 2011 at 10:51 UTC ( [id://892385]=perlquestion: print w/replies, xml ) | Need Help?? |
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have a table in an oracle database the columns contain search details for other tables.
These details are used by a third party product over which I have no control, it searches the same oracle database.
I want to be able to generate a SQL query based on these search details from the table.
These search details are not SQL :(
I've had some success using SQL::Abstract. I am stuck with some of the criteria. For example a record type may be as follows: FOO FOO|BAR|BAZ FO%|B%|CAT Here % is a wildcard, similar to oracle and | is logical OR. The first two aren't a problem, I don't understand how to process the third. In addition to that one of the columns contains a key value pair of a column name and it's value: SHIFT=FOO SHIFT=FO%|BAR Using SQL::Abstract I've written a script, for each filed checking to see if each value contains things like |,%,:,< and > characters. So far in testing this works ok up to a point. I can't working out how to deal with examples containing multiple values which have wild cards (FO%|B%|CAT). With a great number of columns (and a column which contains key value pairs) I'm wondering if there's a more genereric way to do this, without having a stack of if,else conditions for each possible combination. If anyone can advise on a more sensible approach I'd be glad to know it.
Back to
Seekers of Perl Wisdom
|
|