For procedures perform the following:
cursor.callproc("MyPackage.MyProcedure", (arg1, arg2, arg3))
The example you give is a little more complicated, though. First of
all, booleans cannot be bound by the OCI, only within PL/SQL, so your
example of passing block_sample as true cannot be done using
callproc(). Second, referencing package constants cannot be done
directly since Python doesn't know anything about that -- to do that
with callproc you'd have to first grab the constant using an anonymous
PL/SQL block. Third, the method of calling is positional only, not
named as you have indicated.
So, for your case you need to call an anonymous PL/SQL block as in the
following:
cursor.execute("""
begin
dbms_stats.gather_schema_stats(:name, dbms_stats.auto_sample_size,
block_sample =3D> true, options =3D> :options);
end;""",
name =3D 'name',
options =3D 'gather stale')
Hope that helps further your understanding.
On 2/13/06, Orr, Steve <so...@ri...> wrote:
> How do I call an Oracle supplied PL/SQL package.procedure?
>
> Specifically, from SQL*Plus I do this:
> dbms_stats.gather_schema_stats('name', dbms_stats.auto_sample_size, -
> block_sample =3D> true, options =3D> 'gather stale');
>
> How can I call this using cx_Oracle? I see the cursor.callproc(...)
> function but no example of how to use it.
>
> Help! and AtDhVaAnNkCsE !!!
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log fi=
les
> for problems? Stop! Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> http://sel.as-us.falkag.net/sel?cmdlnk&kid=103432&bid#0486&dat=121642
> _______________________________________________
> cx-oracle-users mailing list
> cx-...@li...
> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users
>
|