odbc:param_query with null?

Schlomer, Loren <>
Thu Mar 11 21:53:59 CET 2010


This question was asked a while ago in another thread,

http://www.erlang.org/cgi-bin/ezmlm-cgi?4:mss:46559:200909:lcobkadmljdengloaain

But I cannot find an answer for it.  I have a use case where I have a real-time stream of data coming in that needs to be dumped to
a relational database.  A number of the fields are nullable, and there is no guarantee that there will be data there, but I need to treat
the update as if it were there.  For example,

"insert into TableX values (?, ?, ?)" where the third parameter should be of type float, so the parameters would be [..., {sql_float, [Value]}], however, Value may contain a real value, or it may be undefined..  Of course, odbc:param_query/3 will complain if this value does not match the parameter type.  Does anyone know of an elegant work around?  Some of the tables I am updating may have a dozen or so nullable fields, so having a custom SQL statement for each permutation to catch null fields is certainly not ideal.


Thanks for your help!

-ls


More information about the erlang-questions mailing list