cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

default parameter empty string

kakom
Explorer
0 Kudos
757

I have a stored procedure like this:

create procedure "dba"."xxx"( in @param1 integer,in @param2 integer,in @param3 varchar(4096) default '' ) 
begin
  if @param3 = '' then
/* ... */
  else
/* ... */
  end if
end

Since a long time this worked well as expected. Actually a customer reported a problem and I noticed by testing the following call:

call dba.xxx(11,1)

@param3 comes with value '0'. I am really suprised. Under which circumstances is the default value not reliable?

View Entire Topic
johnsmirnios
Advisor
Advisor
0 Kudos

Did you or your customer connect via TDS? If so, I believe '' is considered equivalent to NULL and comparing anything against NULL would be false (actually 'unknown')?

kakom
Explorer
0 Kudos

Thanks John, but this is not the issue. The default parameter did never take the value NULL