[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]
[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]