ORA-01747: user.table.column, table.column 或列说明无效

[size=medium][color=red]ORA-01747: user.table.column, table.column 或列说明无效[/color][/size]
[color=cyan][size=medium] 原因之一是sql语句拼接错误,多了逗点;二是使用到了oracle的关键字所致[/size][/color]

下面是我在写程序时遇到的异常,是因为sql拼接错误。
[size=medium][color=red]控制台异常:[/color][/size]
[img]http://dl.iteye.com/upload/attachment/0068/4247/42e16df9-158f-3026-8b0f-a78ad5f61b59.bmp[/img]


[color=red][size=medium]dangerousChemicalsUnit.xml[/size][/color]

<update id="updateDangerousChemicalsUnit" parameterClass="dangerousChemicalsUnit">
update dangerousChemicalsUnit set
<dynamic>
<isPropertyAvailable prepend="," property="id">

</isPropertyAvailable>

<isPropertyAvailable prepend="," property="organization">
orgId=#organization.id#
</isPropertyAvailable>
<isPropertyAvailable prepend="," property="orgInternalCode">
orgInternalCode=#orgInternalCode#
</isPropertyAvailable>
<isPropertyAvailable prepend="," property="unitAddress">
unitAddress=#unitAddress#
</isPropertyAvailable>
……
where id = #id#
</dynamic>
</update>


将控制台打印的sql语句在plsql中执行发现:sql语句在xml中拼接错误
[img]http://dl.iteye.com/upload/attachment/0068/4250/4ed239e9-fb35-3449-938f-ac7482d6ef6c.bmp[/img]

[size=medium][color=violet]改正[/color][/size]:[color=red][size=medium]dangerousChemicalsUnit.xml[/size][/color]

<update id="updateDangerousChemicalsUnit" parameterClass="dangerousChemicalsUnit">
update dangerousChemicalsUnit set
<dynamic>
[color=red] unitName=#unitName#[/color]
<isPropertyAvailable prepend="," property="organization">
orgId=#organization.id#
</isPropertyAvailable>
<isPropertyAvailable prepend="," property="orgInternalCode">
orgInternalCode=#orgInternalCode#
</isPropertyAvailable>
<isPropertyAvailable prepend="," property="unitAddress">
unitAddress=#unitAddress#
</isPropertyAvailable>
……
where id =#id#
</dynamic>
</update>

[color=cyan]// 此处只要确保拼接的sql语句正确即可。避免update dangerousChemicalsUnit set ,orgId=#organization.id#.....[/color]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值