0

I need to make an insert with a string literal n with mybatis. The sql query would be something like this:

INSERT INTO table (id, column)
VALUES ('1', n'value');

In mybatis right now I got something like this:

<insert id="createOne" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
    INSERT INTO table
        (
            id,
            column
        )
    VALUES
        (
            FBK_SQ_PAGOPA_CREDITOR_INFO_ID.nextval,
            #{value}
        )
</insert>

I'm not quite sure how can I use the n here... I already tried n#{value}, n'#{value}, n #{value} n${value} with no result. My column type is NVARCHAR2 and I used this type to be able to use the € (eur) symbol with an old charset.

I cannot use this solution How to insert unicode to Oracle NVARCHAR using MyBatis with Spring integration

because I the tomcat used in production is used for multiple project and the system manager said they will not edit the tomcat configuration.

MT0
  • 143,790
  • 11
  • 59
  • 117
LiefLayer
  • 977
  • 1
  • 12
  • 29

1 Answers1

2

You can specify jdbcType or typeHandler explicitly in each parameter reference.

  • #{value,jdbcType=NVARCHAR}
  • #{value,typeHandler=org.apache.ibatis.type.NStringTypeHandler}
ave
  • 3,244
  • 2
  • 14
  • 20