Я создал новую хранимую процедуру на sqlserver, которая может выполняться на профилировщике, но когда я вызываю хранимую процедуру с помощью eclipse, приглашение не может найти хранимую процедуру.Я был бы признателен, если бы вы могли мне немного помочь. Открытый класс TestID {
public static void main(String[] args) {
// TODO Auto-generated method stub
DBUtil db = new DBUtil();
Connection conn = null;
CallableStatement cstmt =null;
try{
conn = db.getConnection();
cstmt = conn.prepareCall("{call dbo.GetSeqVal(?)}");
cstmt.registerOutParameter(1, java.sql.Types.INTEGER);
cstmt.execute();
int count=cstmt.getInt(1);
System.out.println(count);
}catch (Exception e) {
e.printStackTrace();
} finally {
db.closeAll();
}
}
Ниже приведена хранимая процедура, которую я создал в sqlserver, и вызванный statememt
USE [test]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[SP_GetSeqVal]
@result int output
as
begin
declare @NewSeqValue int
set NOCOUNT ON
insert into SEQ_SERIAL_NO(seqval) values ('a')
set @NewSeqValue = scope_identity()
set @NewSeqValue = Convert(char(4),Getdate(),112) + right('000000'+CAST(scope_identity() AS varchar(5)),5)
delete from SEQ_SERIAL_NO WITH (READPAST)
set @result=@NewSeqValue
return @NewSeqValue
end
Declare @NewSeqVal int,@myResult int
Exec @NewSeqVal=GetSeqVal @myResult output
Print @myResult
print @NewSeqVal
.результат будет отображаться после вызова. Что если eclipse вызывает sqlsever, подсказки хранимых процедур не могут найти хранимую процедуру