You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Ramon Misho <Ra...@teranet.ca> on 2004/12/29 16:04:26 UTC

Using Select...like in XML!

Hello IBATIS Support
In my XML file, I need to use a combination of  #value#,  like  and '%'.     For example, if I want all information about users whose first names start with a specific letter 
(say M),  I could write the following statement:
Select * from users_table where user_first_name like 'M%'
 
However,  if the letter is stored in #value# then I might consider writing the following statement (which is NOT working)
            Select * from users_table where user_first_name like '#value#%'
 
My question is:  How does IBATIS handle this situation and how do I make such Select statement work?
 
 
Thanks a lot.
 
 
 
Ramon Misho
System Analyst / Programmer
Mapping Development
 
Teranet Inc.
655 Bay Street, Suite 600
Toronto, ON M5G 2K4
 
Phone 416.326.1322 ext 4150 
Fax 416.314.6140
e-mail: ramon.misho@teranet.ca
Website: http://www.teranet.ca/
 
The information in this e-mail is confidential and may be legally privileged.  It is intended solely for the addressee.  Access to this e-mail by anyone else is unauthorized.  If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful.
 

Re: Using Select...like in XML!

Posted by Brandon Goodin <br...@gmail.com>.
try something of the likes of:

Select * from users_table where user_first_name like #M# + '%'

This will vary depending on which database you use. But the only
variance is the concatenation syntax,

Brandon
 

On Wed, 29 Dec 2004 10:04:26 -0500, Ramon Misho <Ra...@teranet.ca> wrote:
>  
>  
> 
> Hello IBATIS Support 
> 
> In my XML file, I need to use a combination of  #value#,  like  and '%'.    
> For example, if I want all information about users whose first names start
> with a specific letter 
> 
> (say M),  I could write the following statement: 
> 
> Select * from users_table where user_first_name like 'M%' 
> 
>   
> 
> However,  if the letter is stored in #value# then I might consider writing
> the following statement (which is NOT working) 
> 
>             Select * from users_table where user_first_name like '#value#%' 
> 
>   
> 
> My question is:  How does IBATIS handle this situation and how do I make
> such Select statement work? 
> 
>   
> 
>   
> 
> Thanks a lot. 
> 
>   
> 
>   
> 
>   
> 
> Ramon Misho 
> 
> System Analyst / Programmer 
> 
> Mapping Development 
> 
>   
> 
> Teranet Inc. 
> 
> 655 Bay Street, Suite 600 
> 
> Toronto, ON M5G 2K4 
> 
>   
> 
> Phone 416.326.1322 ext 4150 
> 
> Fax 416.314.6140 
> 
> e-mail: ramon.misho@teranet.ca 
> 
> Website: http://www.teranet.ca/ 
> 
>   
> 
> The information in this e-mail is confidential and may be legally
> privileged.  It is intended solely for the addressee.  Access to this e-mail
> by anyone else is unauthorized.  If you are not the intended recipient, any
> disclosure, copying, distribution or any action taken or omitted to be taken
> in reliance on it, is prohibited and may be unlawful. 
> 
>