Dynamic table names in DELETE

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Dynamic table names in DELETE

droidin.net
iBatis 3 has wonderful ability in SELECT statements to provide dynamic substitution before statement is prepared. For example this will work

<select id="foo">SELECT * FROM $db$.MY_TABLE</select>

However I can't make it work when trying to empty table

XML code:

<delete id="del" parameterType="String">DELETE FROM $db$.MY_TABLE</delete>

<delete id="del" parameterType="String">DELETE FROM $0$.MY_TABLE</delete>

Java code:

// method defined as
del(String db);
// and executed as
mapper.del("MY_DB");

I get message complaining that Database '$db$' does not exist

Anyone can suggest the solution? I'm on Teradata db and it is setup in the way that I need provide db names in query or else I get Object not found
Reply | Threaded
Open this post in threaded view
|

RE: Dynamic table names in DELETE

Poitras Christian
Ibatis project moved to Google. If I am not mistaking, the developers of iBATIS are not registered to this list anymore.
Please, post your questions to the new list at [hidden email]

Christian

-----Original Message-----
From: droidin.net [mailto:[hidden email]]
Sent: Sunday, July 18, 2010 11:07 PM
To: [hidden email]
Subject: Dynamic table names in DELETE


iBatis 3 has wonderful ability in SELECT statements to provide dynamic substitution before statement is prepared. For example this will work

<select id="foo">SELECT * FROM $db$.MY_TABLE</select>

However I can't make it work when trying to empty table

XML code:

<delete id="del" parameterType="String">DELETE FROM $db$.MY_TABLE</delete>
<!-- and I also tried -->
<delete id="del" parameterType="String">DELETE FROM $0$.MY_TABLE</delete>

Java code:

// method defined as
del(String db);
// and executed as
mapper.del("MY_DB");

I get message complaining that Database '$db$' does not exist

Anyone can suggest the solution? I'm on Teradata db and it is setup in the way that I need provide db names in query or else I get Object not found

--
View this message in context: http://old.nabble.com/Dynamic-table-names-in-DELETE-tp29201077p29201077.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]