odbc:param_query with null?

Brady McCary brady.mccary@REDACTED
Mon Sep 21 04:11:42 CEST 2009


Erlangers,

Is it possible to pass a null value as a parameter in
odbc:param_query? Something like:

T1 = {sql_varchar, 20},
V1 = null,
P1 = {T1, [V1]},
odbc:param_query(Ref, "exec my_sp @arg1 = ?", [P1]).

T2 = {sql_varchar, 20},
V2 = "blah",
P2 = {T2, [V2]},
odbc:param_query(Ref, "exec my_sp @arg1 = ?", [P2]).

The second query works. The first query does not work, rather it
errors with the following:

{badarg,odbc,param_query,'Params'}

It seems reasonable that there is a convention to pass an sql NULL. I
searched the odbc source for these to try and see if there was any
reasoning to convert something to an sql NULL, but I couldn't find
what I was looking for.

Any help would be much appreciated.

Brady


More information about the erlang-questions mailing list