This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Rust Web Development and have Bastian Gruber on-line!
See this thread for details.
Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

question about default parameters in stored procedure via JDBC

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry I forgot to put environment

SQL server 2000 STD and sql server 2005 Std
OS: Windows server 2003
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic