[erlang-questions] Null parameter for ODBC param_query
Avinash Dhumane
avinash@REDACTED
Fri Apr 20 08:24:42 CEST 2012
I use the ODBC application of Erlang (presently, on R14B02) quite heavily
and with proprietary drivers like AS400 and Netezza.
I rely on odbc:sql_query() - even with parameters - more than on
odbc:param_query(). I use the latter only when to submit a batch of
INSERTs. With former, I construct the SQL string by duly substituting all
the parameter values and submit. So, the submission through ODBC becomes
exactly same as I would do on the SQL command-line interface tool provided
by the DBMS. Applying to your case, I would have done as follows:
lists:flatten(io_lib:fwrite("exec User_Read ~w", [Param])
On Thu, 19 Apr 2012 18:54:16 +0530, Andy Richards
<andy.richards.iit@REDACTED> wrote:
> Hi all,
>
> I found this previous unanswered post to the mailing list and I now face
> the same problem....
>
> http://erlang.2086793.n4.nabble.com/NULL-parameter-for-ODBC-param-query-td3226735.html
>
>> "Is it possible to use null values in a parameterised odbc param_query?
>>
>> example: odbc:param_query("exec User_Read ?", [{sql_integer, Param}]).
>> %
>> Param is either an integer or null
>>
>> The odbc driver returns the 'null' atom when selecting rows, but I
>> haven't
>> found a value that allows me to specify a null parameter ('null',
>> 'NULL',
>> <<"null">>, etc...)"
>
>
> According to the documentation value = null | term() however an
> exception is thrown if the atom null is used?
>
> Has anyone come across this or are there any workarounds to this issue ?
>
> I've already patched the c portion of the odbc driver to resolve a
> socket issue under Linux so I'm wondering if this module is used much in
> the Erlang world?
>
> Many thanks,
>
> Andy.
>
>
>
--
Using Opera's revolutionary email client: http://www.opera.com/mail/
More information about the erlang-questions
mailing list