ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zarar Siddiqi" <zarar.sidd...@utoronto.ca>
Subject Re: problem with delete statement definition , SQL0206 error
Date Wed, 13 Jul 2005 13:27:28 GMT
Well, I don't really know what database you are using or what your db and 
Java types are, but here goes:

<statement id="deleteItem">
    DELETE FROM axvs_item WHERE Id = #itemId# AND CreatorUserId = #userId#
</statement>

Map params = new HashMap();
params.put("itemId", new Integer(itemId));
params.put("userId", new Integer(userId));
SqlMapClient sqlMapClient = Globals.getSqlMapClient();
sqlMapClient.delete("deleteItem", params);

If you are using JDK 1.5, you don't even needto wrap itemId and userId in an 
Integer.









----- Original Message ----- 
From: "Ashish Kulkarni" <kulkarni_ash1312@yahoo.com>
To: <user-java@ibatis.apache.org>
Sent: Tuesday, July 12, 2005 10:05 PM
Subject: Re: problem with delete statement definition , SQL0206 error


> Zarar
> Do you have an example for trying to do what i am
> doing without using a parameter MAP
>
> <delete id="deletePOComment"
>   parameterMap="po-map-param">
> DELETE FROM POCOMMENT WHERE SYSTEM=#system# and
> USER=#user# and ENVNAME=#envname# and
> P204PORD = #ponum# and P204ROUT=#routing#
> </delete>
>
> Ashish
> --- Zarar Siddiqi <zarar.siddiqi@utoronto.ca> wrote:
>
>> You haven't posted the calling code so it's tough to
>> see what might be
>> wrong.  But I have a hunch that this might have to
>> do with "SYSTEM" being a
>> reserved keyword so you might have to escape it with
>> back ticks.  Thats just
>> a shot in the dark.  Also, as far as I can see, just
>> passing in a Map of
>> Integer and String objects should work fine and you
>> don't really need to use
>> a parameter map.
>>
>>
>> ----- Original Message ----- 
>> From: "Ashish Kulkarni" <kulkarni_ash1312@yahoo.com>
>> To: <user-java@ibatis.apache.org>
>> Sent: Tuesday, July 12, 2005 1:59 PM
>> Subject: problem with delete statement definition ,
>> SQL0206 error
>>
>>
>> > Hello
>> > I am getting the following error
>> > Check the  DELETE FROM POCOMMENT WHERE
>> SYSTEM=#system#
>> > and USER=#user# and ENVNAME=#envname# and P204PORD
>> =
>> > #ponum# and P204ROUT=#routing# .
>> > --- Check the SQL Statement (preparation failed).
>> > --- Cause: java.sql.SQLException: [SQL0206] Column
>> > #SYSTEM# not in specified tables.
>> >
>> > Why do i get it,
>> >
>> > Here is what i have defined in my xml file
>> > <parameterMap id="po-map-param" class="Map">
>> > <parameter property="system" jdbcType="VARCHAR"
>> > javaType="java.lang.String" />
>> > <parameter property="user" jdbcType="VARCHAR"
>> > javaType="java.lang.String" />
>> > <parameter property="envname" jdbcType="VARCHAR"
>> > javaType="java.lang.String" />
>> > <parameter property="ponum" jdbcType="NUMERIC"
>> > javaType="java.math.BigDecimal" />
>> > <parameter property="routing" jdbcType="VARCHAR"
>> > javaType="java.lang.String" />
>> > </parameterMap>
>> >
>> > <delete id="deletePOComment"
>> >    parameterMap="po-map-param">
>> > DELETE FROM POCOMMENT WHERE SYSTEM=#system# and
>> > USER=#user# and ENVNAME=#envname# and
>> > P204PORD = #ponum# and P204ROUT=#routing#
>> > </delete>
>> >
>> > I am
>> >
>> >
>> >
>> >
>> > __________________________________
>> > Yahoo! Mail
>> > Stay connected, organized, and protected. Take the
>> tour:
>> > http://tour.mail.yahoo.com/mailtour.html
>> >
>> >
>>
>>
>>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com 



Mime
View raw message