{"id":3050,"date":"2019-11-24T04:37:35","date_gmt":"2019-11-24T11:37:35","guid":{"rendered":"https:\/\/oracletutorial.com\/?page_id=3050"},"modified":"2025-05-31T20:19:41","modified_gmt":"2025-06-01T03:19:41","slug":"calling-a-plsql-procedure-in-python","status":"publish","type":"page","link":"https:\/\/www.oracletutorial.com\/python-oracle\/calling-a-plsql-procedure-in-python\/","title":{"rendered":"Calling PL\/SQL Procedures in Python"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you will learn how to use the <code>Cursor.callproc()<\/code> to call a PL\/SQL procedure from a Python program.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='setting-up-a-plsql-procedure'>Setting up a PL\/SQL procedure <a href=\"#setting-up-a-plsql-procedure\" class=\"anchor\" id=\"setting-up-a-plsql-procedure\" title=\"Anchor for Setting up a PL\/SQL procedure\">#<\/a><\/h2>\n\n\n\n<p>The following statement <a href=\"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-procedure\/\">creates a new procedure<\/a> called <code>get_order_count()<\/code> that returns the number of sales orders by a salesman in a specific year.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">OR<\/span> <span class=\"hljs-keyword\">REPLACE<\/span> <span class=\"hljs-keyword\">PROCEDURE<\/span> get_order_count(\n    salesman_code <span class=\"hljs-built_in\">NUMBER<\/span>, \n    <span class=\"hljs-keyword\">year<\/span> <span class=\"hljs-built_in\">NUMBER<\/span>,\n    order_count <span class=\"hljs-keyword\">OUT<\/span> <span class=\"hljs-built_in\">NUMBER<\/span>)\n<span class=\"hljs-keyword\">IS<\/span>     \n<span class=\"hljs-keyword\">BEGIN<\/span>     \n    <span class=\"hljs-keyword\">SELECT<\/span> \n        <span class=\"hljs-keyword\">COUNT<\/span>(*) <span class=\"hljs-keyword\">INTO<\/span> order_count  \n    <span class=\"hljs-keyword\">FROM<\/span> orders \n    <span class=\"hljs-keyword\">WHERE<\/span> salesman_id = salesman_code <span class=\"hljs-keyword\">AND<\/span>\n        <span class=\"hljs-keyword\">EXTRACT<\/span>(<span class=\"hljs-keyword\">YEAR<\/span> <span class=\"hljs-keyword\">FROM<\/span> order_date) = <span class=\"hljs-keyword\">year<\/span>;\nEXCEPTION\n    WHEN OTHERS THEN\n        dbms_output.put_line(sqlerrm);\n<span class=\"hljs-keyword\">END<\/span>;        \n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>To test the procedure, you can use the following code using SQL*Plus or SQL Developer:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SET<\/span> SERVEROUTPUT <span class=\"hljs-keyword\">ON<\/span>;\n\n<span class=\"hljs-keyword\">DECLARE<\/span>\n    l_order_count <span class=\"hljs-built_in\">NUMBER<\/span>;\n<span class=\"hljs-keyword\">BEGIN<\/span>\n    get_order_count(<span class=\"hljs-number\">54<\/span>,<span class=\"hljs-number\">2017<\/span>,l_order_count);\n    dbms_output.put_line(l_order_count);\n<span class=\"hljs-keyword\">END<\/span>;    \n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The output of the code is:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\">3\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id='calling-a-plsql-procedure-in-python-example'>Calling a PL\/SQL procedure in Python example <a href=\"#calling-a-plsql-procedure-in-python-example\" class=\"anchor\" id=\"calling-a-plsql-procedure-in-python-example\" title=\"Anchor for Calling a PL\/SQL procedure in Python example\">#<\/a><\/h2>\n\n\n\n<p>To execute a PL\/SQL procedure, you use the <code>Cursor.callproc()<\/code> method.<\/p>\n\n\n\n<p>The following code illustrates how to call the procedure <code>get_order_count()<\/code> and print out the number of orders of the salesman 54 in 2017:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-keyword\">import<\/span> oracledb\n<span class=\"hljs-keyword\">import<\/span> logging\n<span class=\"hljs-keyword\">from<\/span> connect <span class=\"hljs-keyword\">import<\/span> connect\n\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">get_order_count<\/span><span class=\"hljs-params\">(salesman_id: int, year: int)<\/span> -&gt; int:<\/span>\n    <span class=\"hljs-keyword\">try<\/span>:\n        <span class=\"hljs-keyword\">with<\/span> connect() <span class=\"hljs-keyword\">as<\/span> connection:\n            <span class=\"hljs-comment\"># Create a new cursor<\/span>\n            <span class=\"hljs-keyword\">with<\/span> connection.cursor() <span class=\"hljs-keyword\">as<\/span> cursor:\n                <span class=\"hljs-comment\"># Create a new variable to hold the value of the OUT parameter<\/span>\n                order_count_var = cursor.var(oracledb.NUMBER)\n\n                logging.info(<span class=\"hljs-string\">f\"Calling stored procedure 'get_order_count' with salesman_id=<span class=\"hljs-subst\">{salesman_id}<\/span>, year=<span class=\"hljs-subst\">{year}<\/span>\"<\/span>)\n                <span class=\"hljs-comment\"># Call the stored procedure. The list order should match the procedure's parameter order.<\/span>\n                cursor.callproc(<span class=\"hljs-string\">'get_order_count'<\/span>, &#91;salesman_id, year, order_count_var])\n\n                <span class=\"hljs-comment\"># Get the value from the OUT parameter<\/span>\n                order_count = order_count_var.getvalue()\n                <span class=\"hljs-keyword\">return<\/span> order_count\n\n    <span class=\"hljs-keyword\">except<\/span> oracledb.Error <span class=\"hljs-keyword\">as<\/span> e:\n        error_message = <span class=\"hljs-string\">f\"Oracle database error while getting order count for salesman_id <span class=\"hljs-subst\">{salesman_id}<\/span>, year <span class=\"hljs-subst\">{year}<\/span>: <span class=\"hljs-subst\">{e}<\/span>\"<\/span>\n        logging.error(error_message)\n        <span class=\"hljs-keyword\">return<\/span> <span class=\"hljs-literal\">None<\/span>\n    <span class=\"hljs-keyword\">except<\/span> Exception <span class=\"hljs-keyword\">as<\/span> e:\n        <span class=\"hljs-comment\"># Catch any other unexpected errors<\/span>\n        error_message = <span class=\"hljs-string\">f\"An unexpected error occurred while getting order count for salesman_id <span class=\"hljs-subst\">{salesman_id}<\/span>, year <span class=\"hljs-subst\">{year}<\/span>: <span class=\"hljs-subst\">{e}<\/span>\"<\/span>\n        logging.critical(error_message) <span class=\"hljs-comment\"># Use critical for unexpected, severe errors<\/span>\n        <span class=\"hljs-keyword\">return<\/span> <span class=\"hljs-literal\">None<\/span>\n\n\n<span class=\"hljs-keyword\">if<\/span> __name__ == <span class=\"hljs-string\">'__main__'<\/span>:\n    \n    order_count = get_order_count(<span class=\"hljs-number\">54<\/span>, <span class=\"hljs-number\">2017<\/span>)\n    <span class=\"hljs-keyword\">if<\/span> order_count <span class=\"hljs-keyword\">is<\/span> <span class=\"hljs-keyword\">not<\/span> <span class=\"hljs-literal\">None<\/span>:\n        print(<span class=\"hljs-string\">f\"The number of orders for salesman 54 in 2017 is: <span class=\"hljs-subst\">{order_count}<\/span>\"<\/span>)\n    <span class=\"hljs-keyword\">else<\/span>:\n        print(<span class=\"hljs-string\">\"Failed to retrieve order count for salesman 54 in 2017.\"<\/span>)\n\n    \n    orders_invalid = get_order_count(<span class=\"hljs-number\">99999<\/span>, <span class=\"hljs-number\">2023<\/span>)\n    <span class=\"hljs-keyword\">if<\/span> orders_invalid <span class=\"hljs-keyword\">is<\/span> <span class=\"hljs-keyword\">not<\/span> <span class=\"hljs-literal\">None<\/span>:\n        print(<span class=\"hljs-string\">f\"The number of orders for salesman 99999 in 2023 is: <span class=\"hljs-subst\">{orders_invalid}<\/span>\"<\/span>)\n    <span class=\"hljs-keyword\">else<\/span>:\n        print(<span class=\"hljs-string\">\"Failed to retrieve order count for salesman 99999 in 2023 (as expected or due to error).\"<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this example:<\/p>\n\n\n\n<p>First, <a href=\"https:\/\/www.oracletutorial.com\/python-oracle\/connecting-to-oracle-database-in-python\/\">connect to the Oracle Database<\/a> by calling the <code>oracledb.connect()<\/code> method with the parameters provided by the <code>config<\/code> module.<\/p>\n\n\n\n<p>Second, create a new <code>Cursor<\/code> object by calling the <code>Connection.cursor()<\/code> method.<\/p>\n\n\n\n<p>Third, create a new variable that will hold the returned value of the <code>OUT<\/code> parameter of the procedure:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">order_count = cursor.var(int)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Fourth, call the procedure <code>get_order_count()<\/code> using the <code>Cursor.callproc()<\/code> method:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">cursor.callproc(<span class=\"hljs-string\">'get_order_count'<\/span>, &#91;salesman_id, year, order_count])<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Finally, call the <code>Variable.getvalue()<\/code> method to return the value of the variable.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-keyword\">return<\/span> order_count.getvalue()<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Since we used the <code>with<\/code> block, the <code>Cursor<\/code> and <code>Connection<\/code> objects were automatically released.<\/p>\n\n\n\n<p>It is important to note that when you call the <code>Cursor.callproc()<\/code> method, oracledb actually generates the following <a href=\"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-anonymous-block\/\">anonymous block<\/a> and then executes it:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">cursor.execute(<span class=\"hljs-string\">\"begin get_order_count(:1,:2,:3); end;\"<\/span>, &#91;salesman_id, year, order_count])\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this tutorial, you have learned how to use the <code>Cursor.callproc()<\/code> method to call a PL\/SQL procedure in Python.<\/p>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful?<\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"3050\"\n\t\t\t\tdata-post-url=\"https:\/\/www.oracletutorial.com\/python-oracle\/calling-a-plsql-procedure-in-python\/\"\n\t\t\t\tdata-post-title=\"Calling PL\/SQL Procedures in Python\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"3050\"\n\t\t\t\tdata-post-url=\"https:\/\/www.oracletutorial.com\/python-oracle\/calling-a-plsql-procedure-in-python\/\"\n\t\t\t\tdata-post-title=\"Calling PL\/SQL Procedures in Python\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\n\t\t\t<button class=\"btn btn-primary wth-btn-submit\">Send<\/button>\n\t\t\t<button class=\"btn wth-btn-cancel\">Cancel<\/button>\n\t\t\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you will learn how to use the Cursor.callproc() to call a PL\/SQL procedure from a Python program.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":2999,"menu_order":7,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-3050","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Calling PL\/SQL Procedures in Python<\/title>\n<meta name=\"description\" content=\"In this tutorial, you will learn how to use the Cursor.callproc() to call a PL\/SQL procedure from a Python program.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.oracletutorial.com\/python-oracle\/calling-a-plsql-procedure-in-python\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Calling PL\/SQL Procedures in Python\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, you will learn how to use the Cursor.callproc() to call a PL\/SQL procedure from a Python program.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.oracletutorial.com\/python-oracle\/calling-a-plsql-procedure-in-python\/\" \/>\n<meta property=\"og:site_name\" content=\"Oracle Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-01T03:19:41+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/python-oracle\\\/calling-a-plsql-procedure-in-python\\\/\",\"url\":\"https:\\\/\\\/www.oracletutorial.com\\\/python-oracle\\\/calling-a-plsql-procedure-in-python\\\/\",\"name\":\"Calling PL\\\/SQL Procedures in Python\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/#website\"},\"datePublished\":\"2019-11-24T11:37:35+00:00\",\"dateModified\":\"2025-06-01T03:19:41+00:00\",\"description\":\"In this tutorial, you will learn how to use the Cursor.callproc() to call a PL\\\/SQL procedure from a Python program.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/python-oracle\\\/calling-a-plsql-procedure-in-python\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.oracletutorial.com\\\/python-oracle\\\/calling-a-plsql-procedure-in-python\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/python-oracle\\\/calling-a-plsql-procedure-in-python\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.oracletutorial.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python Oracle\",\"item\":\"https:\\\/\\\/www.oracletutorial.com\\\/python-oracle\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Calling PL\\\/SQL Procedures in Python\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/#website\",\"url\":\"https:\\\/\\\/www.oracletutorial.com\\\/\",\"name\":\"Oracle Tutorial\",\"description\":\"Oracle Tutorial\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.oracletutorial.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Calling PL\/SQL Procedures in Python","description":"In this tutorial, you will learn how to use the Cursor.callproc() to call a PL\/SQL procedure from a Python program.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.oracletutorial.com\/python-oracle\/calling-a-plsql-procedure-in-python\/","og_locale":"en_US","og_type":"article","og_title":"Calling PL\/SQL Procedures in Python","og_description":"In this tutorial, you will learn how to use the Cursor.callproc() to call a PL\/SQL procedure from a Python program.","og_url":"https:\/\/www.oracletutorial.com\/python-oracle\/calling-a-plsql-procedure-in-python\/","og_site_name":"Oracle Tutorial","article_modified_time":"2025-06-01T03:19:41+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.oracletutorial.com\/python-oracle\/calling-a-plsql-procedure-in-python\/","url":"https:\/\/www.oracletutorial.com\/python-oracle\/calling-a-plsql-procedure-in-python\/","name":"Calling PL\/SQL Procedures in Python","isPartOf":{"@id":"https:\/\/www.oracletutorial.com\/#website"},"datePublished":"2019-11-24T11:37:35+00:00","dateModified":"2025-06-01T03:19:41+00:00","description":"In this tutorial, you will learn how to use the Cursor.callproc() to call a PL\/SQL procedure from a Python program.","breadcrumb":{"@id":"https:\/\/www.oracletutorial.com\/python-oracle\/calling-a-plsql-procedure-in-python\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.oracletutorial.com\/python-oracle\/calling-a-plsql-procedure-in-python\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.oracletutorial.com\/python-oracle\/calling-a-plsql-procedure-in-python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.oracletutorial.com\/"},{"@type":"ListItem","position":2,"name":"Python Oracle","item":"https:\/\/www.oracletutorial.com\/python-oracle\/"},{"@type":"ListItem","position":3,"name":"Calling PL\/SQL Procedures in Python"}]},{"@type":"WebSite","@id":"https:\/\/www.oracletutorial.com\/#website","url":"https:\/\/www.oracletutorial.com\/","name":"Oracle Tutorial","description":"Oracle Tutorial","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.oracletutorial.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/pages\/3050","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/comments?post=3050"}],"version-history":[{"count":0,"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/pages\/3050\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/pages\/2999"}],"wp:attachment":[{"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/media?parent=3050"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}