Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #68311 > unrolled thread
| Started by | Petite Abeille <petite.abeille@gmail.com> |
|---|---|
| First post | 2014-03-13 00:11 +0100 |
| Last post | 2014-03-14 04:32 +1100 |
| Articles | 6 — 5 participants |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: DB API question - where is a stored procedure's return value? Petite Abeille <petite.abeille@gmail.com> - 2014-03-13 00:11 +0100
Re: DB API question - where is a stored procedure's return value? John Gordon <gordon@panix.com> - 2014-03-13 14:43 +0000
Re: DB API question - where is a stored procedure's return value? Skip Montanaro <skip@pobox.com> - 2014-03-13 10:14 -0500
Re: DB API question - where is a stored procedure's return value? Chris Angelico <rosuav@gmail.com> - 2014-03-14 04:01 +1100
Re: DB API question - where is a stored procedure's return value? random832@fastmail.us - 2014-03-13 13:22 -0400
Re: DB API question - where is a stored procedure's return value? Chris Angelico <rosuav@gmail.com> - 2014-03-14 04:32 +1100
| From | Petite Abeille <petite.abeille@gmail.com> |
|---|---|
| Date | 2014-03-13 00:11 +0100 |
| Subject | Re: DB API question - where is a stored procedure's return value? |
| Message-ID | <mailman.8114.1394666303.18130.python-list@python.org> |
On Mar 13, 2014, at 12:00 AM, Ian Kelly <ian.g.kelly@gmail.com> wrote: > 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. Alternatively… if it’s really a function… wrap it in a select statement… such as: select foo() as value from dual
[toc] | [next] | [standalone]
| From | John Gordon <gordon@panix.com> |
|---|---|
| Date | 2014-03-13 14:43 +0000 |
| Message-ID | <lfsg5p$e1a$1@reader1.panix.com> |
| In reply to | #68311 |
In <mailman.8114.1394666303.18130.python-list@python.org> Petite Abeille <petite.abeille@gmail.com> writes: > Alternatively=85 if it=92s really a function=85 wrap it in a select = > statement=85 such as: > select foo() as value from dual That will get the return value into an SQL variable, but the OP wanted to know how to fetch it from python code. -- John Gordon Imagine what it must be like for a real medical doctor to gordon@panix.com watch 'House', or a real serial killer to watch 'Dexter'.
[toc] | [prev] | [next] | [standalone]
| From | Skip Montanaro <skip@pobox.com> |
|---|---|
| Date | 2014-03-13 10:14 -0500 |
| Message-ID | <mailman.8128.1394723684.18130.python-list@python.org> |
| In reply to | #68331 |
Thanks for the responses. We eventually figured out there appears to be a bug in the latest version of the python-sybase module (at least in 0.40, probably in 0.39 as well). It was actually detecting CS_STATUS_RESULT coming from the server and responding appropriately, however it was assigning the actual status result to a local variable instead of an attribute of the Cursor instance. Testing a fix now. Skip
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-03-14 04:01 +1100 |
| Message-ID | <mailman.8129.1394730071.18130.python-list@python.org> |
| In reply to | #68331 |
On Fri, Mar 14, 2014 at 1:43 AM, John Gordon <gordon@panix.com> wrote: >> select foo() as value from dual > > That will get the return value into an SQL variable, but the OP wanted > to know how to fetch it from python code. In theory, that should produce a one-row-one-column SELECT result, which can then be retrieved as such. (I say "in theory" because not all back-end databases support the "from dual" notation - which, by the way, I find extremely odd; what's 'dual' about it?) ChrisA
[toc] | [prev] | [next] | [standalone]
| From | random832@fastmail.us |
|---|---|
| Date | 2014-03-13 13:22 -0400 |
| Message-ID | <mailman.8130.1394731331.18130.python-list@python.org> |
| In reply to | #68331 |
On Thu, Mar 13, 2014, at 13:01, Chris Angelico wrote: > On Fri, Mar 14, 2014 at 1:43 AM, John Gordon <gordon@panix.com> wrote: > >> select foo() as value from dual > > > > That will get the return value into an SQL variable, but the OP wanted > > to know how to fetch it from python code. > > In theory, that should produce a one-row-one-column SELECT result, > which can then be retrieved as such. (I say "in theory" because not > all back-end databases support the "from dual" notation - which, by > the way, I find extremely odd; what's 'dual' about it?) DUAL is an Oracle thing. It used to have two rows, in order to be used to duplicate results by doing a cartesian join to it. At some point, that was removed, but the name stuck. Most other servers allow SELECT without FROM.
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-03-14 04:32 +1100 |
| Message-ID | <mailman.8132.1394731969.18130.python-list@python.org> |
| In reply to | #68331 |
On Fri, Mar 14, 2014 at 4:22 AM, <random832@fastmail.us> wrote: > DUAL is an Oracle thing. It used to have two rows, in order to be used > to duplicate results by doing a cartesian join to it. At some point, > that was removed, but the name stuck. > > Most other servers allow SELECT without FROM. Yeah, I usually use PostgreSQL which does. I don't remember what DB2 has. MySQL I think requires either DUAL or an actual real table. ChrisA
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web