Hi,
In the faq page about null value inserts in here:
http://opensource.atlassian.com/confluence/oss/display/IBATIS/What+cause
s+an+Invalid+column+type+error+with+Oracle
said that you can do something like this and you can prevent the
misleading error 'Invalid Column Type' if the value in line2 and
sold_date is null : 

<insert id="insertAddress" parameterClass="Address">
        INSERT INTO 
            ADDRESS (
                line1,
                line2,
                city,
                state,
                postal_code,
                purchase_date,
                sold_date       
                )
            values (
                        #line1#,
                #line2:VARCHAR#,
                #city#,
                #state#,
                #postal_code#,
                #purchase_date#,
                #sold_date:DATE#        
            )
</insert>

But this solution never works for me (or maybe for oracle..), instead i
always have to do something like : 

<insert id="insertAddress" parameterClass="Address">
        INSERT INTO 
            ADDRESS (
                line1,
                line2,
                city,
                state,
                postal_code,
                purchase_date,
                sold_date       
                )
            values (
                #line1#,
                <isNull property="line2">
                        null,
                </isNull>
                <isNotNull property="line2">
                        #line2#,
                </isNotNull>
                #city#,
                #state#,
                #postal_code#,
                #purchase_date#,
                #sold_date#     
            )
</insert>

I was wondering if someone actually having the same problem with me, 
currently i'm using 
- iBATIS 2.1.5 build 582 
- oracle 8.1.7 
- oracle10g jdbc thin driver (ojdbc14.jar)
- c3p0 0.9.0.2

Thanks :) 
Yusuf.

Reply via email to