On Thu, Mar 13, 2014, at 13:01, Chris Angelico wrote: > On Fri, Mar 14, 2014 at 1:43 AM, John Gordon <gor...@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. -- https://mail.python.org/mailman/listinfo/python-list