Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #31420
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.85.MISMATCH!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.005 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; '16,': 0.03; '"""': 0.05; 'parameter': 0.07; 'subject:using': 0.09; 'passing': 0.15; 'bind': 0.16; 'oct': 0.16; 'subject:variable': 0.16; 'wrote:': 0.17; 'string,': 0.17; 'equivalent': 0.20; 'all,': 0.21; 'pass': 0.25; 'header:In-Reply-To:1': 0.25; 'select': 0.26; 'am,': 0.27; 'separate': 0.27; 'message-id:@mail.gmail.com': 0.27; 'correct': 0.28; 'actual': 0.28; "skip:' 10": 0.30; 'query': 0.30; 'received:209.85.215.46': 0.30; 'to:addr:python-list': 0.33; "can't": 0.34; 'received:google.com': 0.34; 'list': 0.35; 'received:209.85': 0.35; 'list.': 0.35; 'item': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'mean': 0.38; 'to:addr:python.org': 0.39; 'where': 0.40; 'header:Received:5': 0.40; 'your': 0.60; 'to:name:python': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=Fw+Lakx9NcpG+yonWXwM0uZqauFBPRwJZXa46BXVq9E=; b=uVY9LBkIl/tmo6czt4bDkBuNfD1MAXxKjfLRUC5jouzuQNHbajLml3KT8SOu9UJgii mGubrklYNATJBCuQxV9w8ECbunQcEOb+rat4TM1z8DKeMucRHFElnVSM4ndHzTnKU+7f KbiipNUU3VA6hxbklLlsm0qXg4x3Rau3+Ekj5mfNbgxXGk/0u5/v0IC+PLNqOXZSG1az U0tUdCz5OyccV6ig2TiYlDKxXndZjHL09OZaqCYxCeiEAi2H408LAIdRCRDS9auAs6Yp MuPXUIaBkHIX5gyV8UXUEXIEE+qMOE9WQeV3dEPzGrMHpHh/TVYgM/ZPBABXFtvnlYca nGfg== |
| MIME-Version | 1.0 |
| In-Reply-To | <013921b2-122e-4169-bb09-8973e0f07ec1@googlegroups.com> |
| References | <013921b2-122e-4169-bb09-8973e0f07ec1@googlegroups.com> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Tue, 16 Oct 2012 11:04:21 -0600 |
| Subject | Re: cx_Oracle clause IN using a variable |
| To | Python <python-list@python.org> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2292.1350407093.27098.python-list@python.org> (permalink) |
| Lines | 30 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1350407093 news.xs4all.nl 6952 [2001:888:2000:d::a6]:50116 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:31420 |
Show key headers only | View raw
On Tue, Oct 16, 2012 at 7:41 AM, Beppe <giuseppecostanzi@gmail.com> wrote:
> Hi all,
> I don't know if it is the correct place to set this question, however,
The best place to ask questions about cx_Oracle would be the
cx-oracle-users mailing list.
> what is wrong?
> suggestions?
With the bind parameter you're only passing in a single string, so
your query is effectively equivalent to:
SELECT field1,field2,field3
FROM my_table
WHERE field_3 IN ('CNI,CNP')
You can't pass an actual list into a bind parameter the way that you
would like. You need to use a separate parameter for each item in the
list. This may mean constructing the query dynamically:
in_vars = ','.join(':%d' % i for i in xrange(len(sequence_of_args)))
sql = """
SELECT field1,field2,field3
FROM my_table
WHERE field_3 IN (%s)
""" % in_vars
cursor.execute(sql, sequence_of_args)
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
cx_Oracle clause IN using a variable Beppe <giuseppecostanzi@gmail.com> - 2012-10-16 06:41 -0700
Re: cx_Oracle clause IN using a variable Ian Kelly <ian.g.kelly@gmail.com> - 2012-10-16 11:04 -0600
Re: cx_Oracle clause IN using a variable Hans Mulder <hansmu@xs4all.nl> - 2012-10-16 19:22 +0200
Re: cx_Oracle clause IN using a variable Beppe <giuseppecostanzi@gmail.com> - 2012-10-17 06:49 -0700
csiph-web