File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question about default parameters in stored procedure via JDBC

 
jay akhawri
Ranch Hand
Posts: 47
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have a question regading usage of deafult output parametrs in JDBC.
The problem is I am not getting default values as a return of Stored procedure..this is returning NULL.

For example we create a procedure as follows:

CREATE procedure B999EDASOL28XX_SPR25
(
@nch nchar(10) = 'Mars ' OUTPUT ,
@nvc nvarchar(30) = 'Moon ' OUTPUT ,
@ntx ntext = 'Mars lower left of waning crescent Moon.' OUTPUT
)
as
declare @var sql_variant;
set @var = 'qwert12345'
set @var = 12345
select @nch
select @nvc
select @ntx
set @nch = 'Mercury' ;
set @nvc = 'Mercury will have a poor evening appearance in Sept-Oct. '
return (convert(char(20), @var) )
return (convert(int, @var) )


Each of the 3 input/output parameters have a default value
defined in the procedure. When we call the procedure via JDBC, we
prepare and execute the following :

{?=call B999EDASOL28XX_SPR25(?,?,?)}

We do not supply values for any of the input/output parameters,
but SQL Server interprets this as passing NULL instead of using
default value. The result is that all output parameter values are
passed as NULL instead of passing the default value.


I will apriciate your help.

Thanks


Jay
 
jay akhawri
Ranch Hand
Posts: 47
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry I forgot to put environment

SQL server 2000 STD and sql server 2005 Std
OS: Windows server 2003
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic