mirror of
https://github.com/django/django.git
synced 2025-03-25 16:50:45 +00:00
[1.11.x] Fixed #23766 -- Doc'd CursorWrapper.callproc().
Thanks Tim Graham for the review. Backport of 660d50805b6788d592b4f1fae706b725baf0195c from master
This commit is contained in:
parent
7e7edba64b
commit
fe51017efd
@ -346,3 +346,29 @@ is equivalent to::
|
|||||||
c.execute(...)
|
c.execute(...)
|
||||||
finally:
|
finally:
|
||||||
c.close()
|
c.close()
|
||||||
|
|
||||||
|
Calling stored procedures
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
.. method:: CursorWrapper.callproc(procname, params=None)
|
||||||
|
|
||||||
|
Calls a database stored procedure with the given name and optional sequence
|
||||||
|
of input parameters.
|
||||||
|
|
||||||
|
For example, given this stored procedure in an Oracle database:
|
||||||
|
|
||||||
|
.. code-block:: sql
|
||||||
|
|
||||||
|
CREATE PROCEDURE "TEST_PROCEDURE"(v_i INTEGER, v_text NVARCHAR2(10)) AS
|
||||||
|
p_i INTEGER;
|
||||||
|
p_text NVARCHAR2(10);
|
||||||
|
BEGIN
|
||||||
|
p_i := v_i;
|
||||||
|
p_text := v_text;
|
||||||
|
...
|
||||||
|
END;
|
||||||
|
|
||||||
|
This will call it::
|
||||||
|
|
||||||
|
with connection.cursor() as cursor:
|
||||||
|
cursor.callproc('test_procedure', [1, 'test'])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user