From: Jeffrey Z. <Jef...@q-...> - 2009-09-08 10:46:18
|
Hi, I need to pass SQL NULL for one of the input parameters to a stored procedure. This stored procedure is called via the usual: cursor.callproc('storedprocname', parameterdictionary) The usual way to pass SQL NULL using the Python DB-API is to pass None instead. However, this causes python-sybase to throw an exception, as shown here: Traceback (most recent call last): File "/home/jeffreyz/workspace-3.5/generate-client-test-data/src/generate_dat a_tests.py", line 100, in <module> '@op_ClientNumber': Sybase.OUTPUT(1)}) File "build/bdist.linux-i686/egg/Sybase.py", line 426, in callproc File "build/bdist.linux-i686/egg/Sybase.py", line 703, in _start File "build/bdist.linux-i686/egg/Sybase.py", line 717, in _mainloop File "build/bdist.linux-i686/egg/Sybase.py", line 761, in _raise_error Sybase.DatabaseError: Msg 257, Level 16, State 1, Procedure qp_GUI_ClientInsert Implicit conversion from datatype 'INT' to 'UNIVARCHAR' is not allowed. Use the CONVERT function to run this query. For some reason, it triggers an "Implicit conversion from datatype 'INT' to 'UNIVARCHAR' is not allowed" exception. For this particular case, the input parameter is of type UNIVARCHAR, but this problem is not particular to input parameters of only this type. For this particular case, SQL NULL is a legal value to pass to the stored procedure. I have found one other reference to this issue here: http://www.archivum.info/comp.databases.sybase/2007-08/00008/15.0.2_upgr ade_issue_wrt_passing_null_parameters_to_procedure Is this a known problem? Is there a simple fix? Or am I doing something stupid? Regards, Jeffrey |