【发布时间】:2011-09-18 03:59:37
【问题描述】:
关于存储过程的问题:
如何从声明为输出变量的存储过程中检索变量的值。
运行程序为:
EXEC pn_investment_type_eqt {args}
这里是存储过程:
create proc pn_investment_type_eqt
(
@product_type varchar(10),
@country varchar(10),
@fi_treatment varchar(1)= '',
@investment_type varchar(10) output,
@investment_description varchar(50) output
)
as
set nocount on
if @country <> 'US'
select @country = 'FOREIGN'
if ( @fi_treatment not in ('Y','N') )
select @fi_treatment = 'N'
if not exists(select 1 from d_investment_type_eqt
where product_type = @product_type and isNull(country,'') = isNull(@country,'') and fi_treatment = @fi_treatment and row_status='A' )
begin
select @country = 'ANY'
end
if exists ( select 1 from d_investment_type_eqt
where product_type = @product_type and isNull(country,'') = isNull(@country,'') and fi_treatment = @fi_treatment and row_status='A' )
begin
select @investment_type= investment_type , @investment_description = description
from d_investment_type_eqt
where product_type = @product_type and isNull(country,'') = isNull(@country,'') and fi_treatment = @fi_treatment and row_status='A'
end
else
return (-1)
我需要获取@investment_type 和@investment_description 的值。
我无法更改程序。
我正在使用 Spring 2.0 的 jdbcTemplate 的自定义实现(sql、mapper、args)
数据库是 Sybase
我怎样才能从这个存储过程中得到结果?
【问题讨论】:
-
"if @country 'US' select @country = 'FOREIGN'"... 这适用于 so 多个级别! :o)
标签: java sql spring stored-procedures sybase