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 :
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.
Joined: Nov 28, 2004
Sorry I forgot to put environment
SQL server 2000 STD and sql server 2005 Std OS: Windows server 2003
subject: question about default parameters in stored procedure via JDBC