Keep in mind that LIKE, to act as a substring search, needs to have % around the search value; either appended, or prepended, or on both sides (three different searches!); i.e.:

job LIKE 'trans01%' -- , or:

job LIKE '%trans01' -- , or:

job LIKE '%trans01%'

And job LIKE 'trans01' means: job equals 'trans01'. It is possible but unlikely because if you wanted equality you would normally spell it job = 'trans01'

If you use place holders: column like ( '%' || ? || '%' )

BTW, it seems you'd better forget about the ESCAPE '!' as they are not used in your statement anyway.

BTW 2: LIKE '%' doesn't do anything at all it seems so better to leave them out.


In reply to Re: Simplifying queries in DBI by erix
in thread Simplifying queries in DBI by neilwatson

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.