配置文件:
<?xml
version="1.0"
encoding="GBK"?>
<!DOCTYPE
sqlMap
PUBLIC
"-//iBATIS.com//DTD
SQL Map 2.0//EN"
"http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap
namespace="Test">
<update
id="update"><![CDATA[
declare
n_count number;
begin
select count(*) into n_count from
t_account;
update t_auth set
s_authdesc='记录数:'||n_count;
end;
]]>
</update>
</sqlMap>
测试代码:
public
class
Test
{
public
static
void
main(String[] args)
{
SqlMapClient sqlMap =
SqlMapConfig.getSqlMap();
try
{
sqlMap.startTransaction();
sqlMap.update("Test.update",
null);
sqlMap.commitTransaction();
}
catch
(SQLException e)
{
e.printStackTrace();
}
finally
{
try
{
sqlMap.endTransaction();
}
catch
(SQLException e)
{
e.printStackTrace();
}
}
}
}