ibatis与存储过程(带输出参数的存储过程)

  • Post author:
  • Post category:其他




全部是针对Microsoft SQL Server 2000的Stored Procedure的例子:

参照《iBATIS in Action》书写:


1.



max_in_example




Stored Procedure:


CREATE


PROCEDURE [dbo].[max_in_example]
@a

INTEGER = 0

OUTPUT

,
@b

INTEGER = 0

OUTPUT

,
@c

INTEGER = 0

OUTPUT


AS

BEGIN

IF

(@a > @b)

SET

@c = @a

ELSE

SET

@c = @b

RETURN

@c

END

GO


SqlMap:


<


parameterMap


id


=


“pm_in_example”


class


=


“java.util.Map”


>



<


parameter


property


=


“c”


javaType


=


“int”


jdbcType


=


“INTEGER”



mode


=


“OUT”


/>



<


parameter


property


=


“a”


javaType


=


“int”


jdbcType


=


“INTEGER”


/>



<


parameter


property


=


“b”


javaType


=


“int”


jdbcType


=


“INTEGER”


/>



</


parameterMap



版权声明:本文为fy_kenny原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。