Saturday, April 28, 2012

Re: django and oracle --

On Sat, 28 Apr 2012 19:30:27 +0200, gmail <>
declaimed the following in gmane.comp.python.django.user:

> i hope someone here can help me. i have a problem with django e oracle.
> above the code with problem:

No code "above", but code is "below"...
> insert = """insert into modello (title, descrizione, url, prezzo,
> sconto) values (:title, :descrizione, :url,
> :prezzo, :sconto)"""
> try:
> self.c.execute(insert,{'title':item['title'],
> 'descrizione':item['descrizione'],
> 'url':item['url'],
> 'prezzo':['prezzo'], 'sconto':item['sconto']})
> when try this code the system report this error:
> ORA-01484:arrays can only be bound to PL/SQL statement
Nothing in this appears to be Django relevant; you are specifying
straight SQL, and using what appears to be an Oracle compliant DB-API
module. The error message looks to be pure Oracle (unless the Oracle
DB-API creates very odd exceptions).

The first thing I notice is that you are creating a temporary
dictionary of parameters to the SQL. The values of this dictionary are
coming from a dictionary -- "item" -- which just happens to use the very
same text strings as keys. So why bother with the temporary dictionary,
just pass:

self.c.execute(insert, item)

As for the Oracle error -- the only thing I can suggest is dumping
out the representation of "item" to see if some field has a value that
looks like an array to Oracle.
Wulfraed Dennis Lee Bieber AF6VN HTTP://

You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment