JAVA 调用存储程序
有类似如下SQL2000的存储程序,JAVA中该如何正确调用
CREATE proc GetFixFlow
( @BarCode varchar(30))
as
create table #FixFLow
(
fDate datetime null,
flag varchar(20) null,
fNO varchar(20) null,
fman varchar(20) null,
fdep varchar(100) null
)
insert into #FixFLow(fDate,flag,fNO,fman,fdep)
select F_Date,'入库',Fix_Batch.F_Number,p1.P_Name ,'采购人:'+p2.P_Name+ '.'+ '单位:'+ F_Factory+'.' + '仓库:'+ S_Name
from Fix_Batch left join Fix_Product on Fix_Batch.F_Number=Fix_Product.F_Number
left join Storeroom_Set on Fix_Product.S_Number=Storeroom_Set.S_Number
left join Person_Set p1 on F_StorageMan=p1.P_Number
left join Person_Set p2 on Fix_Batch.F_BuyMan = p2.P_Number
where F_CodeBar = @BarCode
insert into #FixFLow(fDate,flag,fNO,fman)
select F_RejectDate,'报废',FR_Number,P_Name
from Fix_Reject,Person_Set where
Fix_Reject.F_RejectMan=Person_Set.P_Number and F_CodeBar = @BarCode
select #FixFLow.fDate, #FixFLow.flag, #FixFLow.fNO, #FixFLow.fman, #FixFLow.fdep from #FixFLow order by fDate
GO
----------------------------------
DriverManager.registerDriver(new sun.jdbc.odbc.JdbcOdbcDriver());
//获得链接
Connection conn=DriverManager.getConnection("jdbc:odbc:gdzc", "sa", "");
//创建存储过程的对象
CallableStatement c = conn.prepareCall("call GetFixFlow");
ResultSet rs = c.executeQuery();
while(rs.next()){
Date fDate = rs.getDate("fDate");
String flag = rs.getString("flag");
String fNO = rs.getString("fNO");
String fman = rs.getString("flag");
String fdep = rs.getString("fdep");
}
c.close();
----------------------这样调用问题在哪?
------解决方案--------------------上面是举个例子,不需要参数的话,直接"call 存储过程名",你的问题是什么?