On Aug 14, 2009, at 9:16 AM, Nick Martin wrote:

>
> Hi,
>
> I've been trying to get my head around how to call custom functions in
> Oracle.
>
> In straight SQL it would usually be:
> "exec blah.fishcakes(1);"
>
> Where blah is the package name, and fishcakes the name of the
> function.
>
> For stored procedures I've tried doing:
> mqry = select([func.blah.fishcakes(foo)])
>
> Which produces, "select blah.fishcakes(foo) from dual;" allowing one
> to select from a stored procedure.
> I am wondering if there is a way to execute custom functions
> programmatically in sqlalchemy.

I think you've confused the two: that select statement will work for  
functions, not stored procedures.

exec is for stored procedures, and exec foo(1) is really just: begin  
foo(1); end;

So you'd want db.execute(text('begin blah.fishcakes(:foo); end;'),  
foo=foo)

--
Philip Jenvey


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to