• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

question about default parameters in stored procedure via JDBC  RSS feed

 
Ranch Hand
Posts: 47
  • 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
  • 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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!