Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Simplifying queries in DBI

by erix (Vicar)
on Mar 16, 2014 at 16:16 UTC ( #1078525=note: print w/ replies, xml ) Need Help??


in reply to Simplifying queries in DBI

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.


Comment on Re: Simplifying queries in DBI
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1078525]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (12)
As of 2014-08-28 06:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (257 votes), past polls