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.

In reply to SQL::Abstract with non SQL source data by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.