Re: Store Procedure Like

Randy Clamons <[email protected]>
Newsgroups gmane.comp.db.mysql.windows
Message-ID <[email protected]>
Looks like you have named your variable the same as your column name. 
That could cause some confusion--both to you and ythe query processor.

Looks like you want to find rows where RefTrans contains the phrase 
passed to the parameter.

The first example doesn't work because the _ and % are 'bare 
words'--strings not enclosed by quotes.

The second one returns rows that begin with a space, followed by any 
number of any character followed by 'RefTrans' (literal) followed by a 
space then any number of any character followed by a space. I'm guessing 
it returns nothing.

Try this:

CREATE PROCEDURE procName (IN lReftrans)
BEGIN
...
WHERE pagto_boleto.RefTrans LIKE CONCAT('%',lReftrans,'%')
...
END;

That will find rows containing the parameter phrase.

It might be simpler for you, and maybe mySql too, to use a regular 
expression for this:

WHERE pagto_boleto.RefTrans REGEXP lRefTrans


Randy Clamons
Systems Programming
[email protected]


Hotmail wrote:
> Hello
>  I have a ST that it receives one In entrance this variavel use to generate: 
> TSQL with like: 
>  Where pagto_boleto.RefTrans like _ RefTrans % return erro, can make?  
> 
> Where pagto_boleto.RefTrans like ' %_RefTrans % ' did not function 
> 
>  can help me?
> 
> Julio Cesar 

-- 
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe:    http://lists.mysql.com/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.