From fe51017efdc3f26c94c83fe5930b14d71e1bb380 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Thu, 10 Aug 2017 22:21:11 +0200 Subject: [PATCH] [1.11.x] Fixed #23766 -- Doc'd CursorWrapper.callproc(). Thanks Tim Graham for the review. Backport of 660d50805b6788d592b4f1fae706b725baf0195c from master --- docs/topics/db/sql.txt | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/docs/topics/db/sql.txt b/docs/topics/db/sql.txt index b5c45844cd..94e08b8bef 100644 --- a/docs/topics/db/sql.txt +++ b/docs/topics/db/sql.txt @@ -346,3 +346,29 @@ is equivalent to:: c.execute(...) finally: 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'])