Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'anyway.': 0.05; 'output': 0.05; 'method:': 0.09; 'parameter': 0.09; 'pep': 0.09; 'solution,': 0.09; 'subject:question': 0.10; 'stored': 0.12; 'subject:API': 0.16; 'subject:where': 0.16; 'values?': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'skip': 0.24; 'query': 0.26; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'skip:p 30': 0.29; 'message-id:@mail.gmail.com': 0.30; "can't": 0.35; 'but': 0.35; 'received:google.com': 0.35; 'subject:?': 0.36; 'list': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'does': 0.39; '12,': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'skip:p 20': 0.39; 'mar': 0.68 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=JpHzuhCE/OpgTBPcn/l0G01XtYt2vHSp763Hj6iBR4M=; b=fNu69KrqRWKoAk7jEUABIwZIBahY51OcoefhUJ4KgfOw6Gb2TVINshxOWokUOQN5A+ F0orh/+RmCHmi7T7zmOQm+uUb6oNnjbNzf31cSIJMG7+jnojNFsJUoc5+KXJuKi77gdO wmkmNEGI/PPPvrcY9qd7frtCYmhVaTcPkVu/aqSOQS6bpo7KM3gu0PfNwtFmwexwOHlQ KmOVr3uxYh7IX3vxOqmi+Xv3b+tyYFAu/Ks7vSQalro+y67HI9qd4UIBHm4vyl/oFYwS rO8n6/AkgfluJZT07DQ3Z4WIioOr3scVv7usL9QYeCEVdLyIgJ5bI5+ukmlKpweZiVhD aEiA== X-Received: by 10.66.121.195 with SMTP id lm3mr169818pab.154.1394665253297; Wed, 12 Mar 2014 16:00:53 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: Ian Kelly Date: Wed, 12 Mar 2014 17:00:12 -0600 Subject: Re: DB API question - where is a stored procedure's return value? To: Python 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1394665261 news.xs4all.nl 2927 [2001:888:2000:d::a6]:45521 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:68305 On Wed, Mar 12, 2014 at 3:44 PM, Skip Montanaro wrote: > What do other database adaptors do about stored procedure return > values? Does PEP 249 need revision? I can't speak generally, but in cx_Oracle you either execute a query like this: result = cursor.var(cx_Oracle.NUMBER) cursor.execute(":1 := test_proc()", [result]) print(result.getvalue()) or you use the non-standard callfunc method: print(cursor.callfunc("test_proc", cx_Oracle.NUMBER)) As a general solution, one might wrap a stored procedure that returns a value into a stored procedure that has an output parameter and call it with callproc. Some implementations might include a return value in the parameter list anyway.