-- Not sure if this a bug, or a lack of understanding on my part... but I want to use a DEFAULT value of NULL on a stored procedure parm, and SQLA returns a value of 0 when I would expect a either NULL or a type mismatch error.
CREATE PROCEDURE parm_test (
--- Now... I call the procedure...
Call parm_test (1) -- it works as expected. Parameter 2 defaults to Null
-- Here is the problem:
-- Seems to me that the empty string on the call is most likely caused by a programmer's error, but SQLA converts it to what could be a valid value. I don't think that's right.
asked 29 Jan '10, 19:35
The procedure call is handling type conversion of its arguments precisely the same way in which the server performs type conversion during query execution. For example,
select cast( '' as integer )
also gives 0 as a result. Unlike other DBMS products, SQL Anywhere does differentiate between NULL and the empty string, and when coercing string values to numerics the server treats both '0' and the empty string as 0.
answered 29 Jan '10, 20:48