Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3280

"Not enough values for host variables" when setting more than one variable from Python with SQLAnywhere10

$
0
0

The following statements all work perfectly:

 

cur.execute('SELECT ?, ?', [1, 2])

cur.execute('BEGIN DECLARE a int; set a = ?; SELECT 1; END', [1])

cur.execute('BEGIN DECLARE a int; set a = ?; SELECT a; END', [1])

cur.execute('BEGIN DECLARE a int; DECLARE b int; SET a = ?; SELECT a; END', [1])

 

But the following doesn't:

 

cur.execute('BEGIN DECLARE a int; DECLARE b int; SET a = ?; SET b = ?; SELECT a; END', [1, 2])

 

It fails with:

 

Traceback (most recent call last):

  File "<console>", line 1, in <module>

  File "/Users/asday/.virtualenvs/store-first/lib/python2.7/site-packages/sqlanydb.py", line 792, in execute

    self.executemany(operation, [parameters])

  File "/Users/asday/.virtualenvs/store-first/lib/python2.7/site-packages/sqlanydb.py", line 769, in executemany

    self.handleerror(*self.parent.error())

  File "/Users/asday/.virtualenvs/store-first/lib/python2.7/site-packages/sqlanydb.py", line 689, in handleerror

    eh(self.parent, self, errorclass, errorvalue, sqlcode)

  File "/Users/asday/.virtualenvs/store-first/lib/python2.7/site-packages/sqlanydb.py", line 379, in standardErrorHandler

    raise errorclass(errorvalue,sqlcode)

OperationalError: ('Not enough values for host variables', -188)

 

Why?  I need to be able to set more than one variable at a time, it's kind of important.


Viewing all articles
Browse latest Browse all 3280

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>