You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by Mark Witt <ma...@yahoo.com> on 2006/08/03 20:32:39 UTC

Need ability to send complete SQL to Mapper file

  Hi all – 
   
  We are using IBatis DataMapper 1.3 and have a requirement to re-use some existing functionality where plain text sql is stored in our database.  
   
  We need the ability to extract that sql from the database in one step and then pass that sql with some parameters populated to the SqlMapper and execute that statement.
   
  Here’s an example of what we are trying to do:
      <statement id="DynamicQuery" parameterClass="string" >
        #value#
      </statement>
   
  and we’d pass the a select statement like “select sysdate from dual” as a parameter.
   
              string _query = "select sysdate from dual";
   
              return SqlMapper.QueryForObject("DynamicQuery", _query);
   
  This is throwing the following Oracle exception: ORA-01036: illegal variable name/number.
   
  Any thoughts on whether this is possible?  Or if anyone has attempted something similar, please advise.
   
  Thanks in advance for any feedback.

Mark Witt  
 		
---------------------------------
Yahoo! Music Unlimited - Access over 1 million songs.Try it free. 

RE: Need ability to send complete SQL to Mapper file

Posted by Mark Witt <ma...@yahoo.com>.
Thanks Paul...That worked.

Paul Deweese <pd...@msfw.com> wrote:     I would try to use the string replacement syntax $value$ instead of the  parameter replacement syntax #value#.
  
 Hope that helps.
  
 Paul D.

  
---------------------------------
 From: Mark Witt [mailto:mark_l_witt@yahoo.com]  
Sent: Thursday, August 03, 2006 1:33 PM
To:  user-cs@ibatis.apache.org
Subject: Need ability to send complete SQL  to Mapper file


 
 Hi all –  
 
 We are  using IBatis DataMapper 1.3 and have a requirement to re-use some existing  functionality where plain text sql is stored in our database.   
 
 We need  the ability to extract that sql from the database in one step and then pass that  sql with some parameters populated to the SqlMapper and execute that  statement.
 
 Here’s an  example of what we are trying to do:
      <statement id="DynamicQuery" parameterClass="string"  >
        #value#
      </statement>
 
 and we’d  pass the a select statement like “select sysdate from dual” as a  parameter.
 
              string _query = "select sysdate from dual";
 
              return SqlMapper.QueryForObject("DynamicQuery", _query);
 
 This is  throwing the following Oracle exception: ORA-01036: illegal variable  name/number.
 
 Any  thoughts on whether this is possible?  Or if anyone has  attempted something similar, please advise.
 
 Thanks in  advance for any feedback.

Mark Witt   

---------------------------------
 Yahoo! Music Unlimited - Access over 1 million songs. Try  it free. 

 		
---------------------------------
How low will we go? Check out Yahoo! Messenger’s low  PC-to-Phone call rates.

RE: Need ability to send complete SQL to Mapper file

Posted by Paul Deweese <pd...@msfw.com>.
I would try to use the string replacement syntax $value$ instead of the
parameter replacement syntax #value#.
 
Hope that helps.
 
Paul D.

________________________________

From: Mark Witt [mailto:mark_l_witt@yahoo.com] 
Sent: Thursday, August 03, 2006 1:33 PM
To: user-cs@ibatis.apache.org
Subject: Need ability to send complete SQL to Mapper file


Hi all - 
We are using IBatis DataMapper 1.3 and have a requirement to re-use some
existing functionality where plain text sql is stored in our database.  
We need the ability to extract that sql from the database in one step
and then pass that sql with some parameters populated to the SqlMapper
and execute that statement.
Here's an example of what we are trying to do:
    <statement id="DynamicQuery" parameterClass="string" >
      #value#
    </statement>
and we'd pass the a select statement like "select sysdate from dual" as
a parameter.
            string _query = "select sysdate from dual";
            return SqlMapper.QueryForObject("DynamicQuery", _query);
This is throwing the following Oracle exception: ORA-01036: illegal
variable name/number.
Any thoughts on whether this is possible?  Or if anyone has attempted
something similar, please advise.
Thanks in advance for any feedback.

Mark Witt 

________________________________

Yahoo! Music Unlimited - Access over 1 million songs. Try it free.
<http://pa.yahoo.com/*http://us.rd.yahoo.com/evt=36035/*http://music.yah
oo.com/unlimited/>