问题描述
当我尝试使用Mybatis创建表时出现错误。
问题出现的环境背景及自己尝试过哪些方法
我想用Mybatis创建动态表,即根据传入的参数来生成表:
<update id="createTable">
create table ${tableName}
(
ID VARCHAR2(50) not null
constraint ${tableName}_PK primary key
)/
comment on table ${tableName} is '${tableComment}'
/
</update>
日志提示ORA-00922: 选项缺失或无效
,最后面的斜杠去掉,错误依旧。
当去掉comment那句后,执行成功了。create语句不能放在begin-end里,看来只能执行单个语句。但是这样表就没有注释了:
<update id="createTable">
create table ${tableName}
(
ID VARCHAR2(50) not null
constraint ${tableName}_PK primary key
)
</update>
如果我想在建表的同时添加comment,应该怎么做?