{"id":4366,"date":"2022-10-18T22:06:44","date_gmt":"2022-10-18T22:06:44","guid":{"rendered":"https:\/\/nenadnoveljic.com\/blog\/?p=4366"},"modified":"2022-10-18T22:06:46","modified_gmt":"2022-10-18T22:06:46","slug":"bind_variable_length","status":"publish","type":"post","link":"https:\/\/nenadnoveljic.com\/blog\/bind_variable_length\/","title":{"rendered":"Bind Variable Length in PL\/SQL, C, Java and Python"},"content":{"rendered":"<p>Bind variable length has a significant impact on the execution plan. The change in size can prompt optimizer to create a new child cursor. Mohamed Houri described this behavior in his blog post <a href=\"https:\/\/blog.toadworld.com\/why-my-execution-plan-has-not-been-shared-part-iii\">Why my execution plan has not been shared \u2013 Part III<\/a>  .<\/p>\n<p>In this article I discuss nuances of how different programming languages handle bind variable length. The experiments were performed in Oracle releases 19.16 and 21.7.<\/p>\n<h1>SQLPlus<\/h1>\n<p>I&#8217;ll start with a short demo in SQLPlus. First, I&#8217;ll pass the variable of the length <span style=\"color:red\">20<\/span> to a query:<\/p>\n<pre><code>create table t (c varchar2(4000));\n\nvar v varchar2(<span style=\"color:red\">20<\/span>)\nexec :v := 'AAAA'\nselect * from t where c=:v ;<\/code><\/pre>\n<p>The optimizer created a child cursor for the VARCHAR2(<span style=\"color:red\">20<\/span>) variable.<\/p>\n<pre><code>select count(*) from v$sql_shared_cursor where sql_id = '5a8bp2fr4v6w9' ;\n\n  COUNT(*)\n----------\n         <span style=\"color:red\">1<\/span><\/code><\/pre>\n<p>If we increase the size in declaration to <span style=\"color:red\">90<\/span>, the optimizer will create another cursor:<\/p>\n<pre><code>var v varchar2(<span style=\"color:red\">90<\/span>)\nexec :v := 'AAAA'\nselect * from t where c=:v ;\n\nselect count(*) from v$sql_shared_cursor where sql_id = '5a8bp2fr4v6w9' ;\n\n  COUNT(*)\n----------\n         <span style=\"color:red\">2<\/span><\/code><\/pre>\n<p>It&#8217;s worth noting that I just changed the definition of the bind variable, but the value remained the same (&#8216;AAAA&#8217;). Although the value hasn&#8217;t changed, the optimizer generated a new child cursor.<\/p>\n<p>Two cursors are for two ranges of VARCHAR2 sizes &#8211; one with the upper limit of 2000 characters and the other with the upper limit of 128 characters:<\/p>\n<pre><code>select datatype_string from v$sql_bind_capture where  sql_id = '5a8bp2fr4v6w9' ;\nDATATYPE_STRING\n------------------------------------------------------------\nVARCHAR2(2000)\nVARCHAR2(128)<\/code><\/pre>\n<h1>Peculiarity<\/h1>\n<p>Let&#8217;s take a closer look at the cursors and bind variables lengths that were passed when the cursors were created. The first cursor was created for the bind variable length 20 and the second for 90.<\/p>\n<pre><code>select datatype_string from v$sql_bind_capture where  sql_id = '5a8bp2fr4v6w9' ;\nDATATYPE_STRING\n------------------------------------------------------------\nVARCHAR2(2000)\nVARCHAR2(128)<\/code><\/pre>\n<p>But the bind variable lengths 20 and 90 don&#8217;t match the buckets for which the child cursors were created (128 and 2000, respectively). Both bind variable lengths, i.e. 20 and 90, should have fit into the first bucket, that is VARCHAR2(128). Simply put, the second cursor, i.e. for the bucket with the upper limit 2000 shouldn&#8217;t have been created.<\/p>\n<p>In order to understand why the second cursor was created we need to find out which bind variable length is being passed to the database.<\/p>\n<h1>SQL Trace<\/h1>\n<p>The information about the bind variable length is burried deep down in the SQL trace file and it isn&#8217;t documented. I identified the field where it&#8217;s stored by passing variables of different lengths and correlating a known bind variable length with the cryptic data in the raw SQL trace file. For example, below is the bind entry for the SQLPlus call where I passed the value <span style=\"color:red\">90<\/span>:<\/p>\n<pre><code> Bind#0\n  oacdty=01 <span style=\"color:red\">mxl<\/span>=2000(<span style=\"color:red\">270<\/span>) mxlc=00 mal=00 scl=00 pre=00\n  oacflg=03 fl2=1000000 frm=01 csi=873 siz=2000 off=0\n  kxsbbbfp=7f9982103b40  bln=2000  avl=04  flg=05\n  value=\"AAAA\"<\/code><\/pre>\n<p>In fact, we&#8217;re dealing with two sizes. One is the actual size of the passed data, which is 4 for the string &#8220;AAAA&#8221;. It&#8217;s stored in the field avl, as documented in <a href=\"https:\/\/method-r.com\/wp-content\/uploads\/2018\/07\/TCAP-from-MOTD2.pdf\">Cary Millsap&#8217;s book The Method R Guide to MASTERING ORACLE TRACE DATA<\/a>. We won&#8217;t consider the actual size further, because it&#8217;s irrelevant for the optimizer.  The value of interest is <span style=\"color:red\">mxl<\/span>, which possibly stands for &#8220;maximum length&#8221;. Unlike avl, <span style=\"color:red\">mxl<\/span> contains the bind vaiable length, and it is relevant for the optimizer. It consists of two values: 2000(<span style=\"color:red\">270<\/span>). <span style=\"color:red\">270<\/span> determines in which bucket the bind variable value will be placed. 2000 is the upper limit of the bucket. Simply put, <span style=\"color:red\">270<\/span> belongs to the bucket with the upper limit 2000.<\/p>\n<p>The question is: where did the value <span style=\"color:red\">270<\/span> come from? The variable length in declation, i.e. <span style=\"color:red\">90<\/span>, was multiplied by 3 (<span style=\"color:red\">90<\/span>*3=<span style=\"color:red\">270<\/span>). Optimizer uses <span style=\"color:red\">270<\/span> for deciding in which bucket to place the bind variable. To understand where the multiplication by 3 had came from, I did an experiment using the Oracle Call Interface (OCI) with C. In C we have the highest degree of control of what&#8217;s being sent to the database.<\/p>\n<h1>C<\/h1>\n<p>I <a href=\"https:\/\/github.com\/nenadnoveljic\/blogs\/blob\/master\/bind-variable-length\/cursor.c\">modified cdemo81.c OCI demo program<\/a> to bind a known value and correlate it with the raw SQL Trace data. The code for binding the variable looks like this:<\/p>\n<pre><code>static text *selt = (text *)\"SELECT 1 FROM t WHERE c = :C\";\n...\ntext     *c = (text *)\"AAAA\";\n...\n  if ((status = OCIBindByName(stmthp1, &amp;bnd1p, errhp, (text *) \":C\",\n             -1, (dvoid *) c,\n             <span style=\"color:red\">90<\/span>, SQLT_STR, (dvoid *) 0,\n             (ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT)) )\n  {\n    checkerr(errhp, status);\n    finish_demo(svchp, srvhp, authp,stmthp, stmthp1,inserthp);\n    return OCI_ERROR;\n  }<\/code><\/pre>\n<p>My call to OCIBindByName binds the text &#8220;AAAA&#8221; to the bind variable &#8220;:C&#8221;. The specification of OCIBindByPos is as follows:<\/p>\n<pre><code>sword OCIBindByPos ( OCIStmt       *stmtp, \n                     OCIBind      **bindpp,\n                     OCIError      *errhp,\n                     ub4            position,\n                     void          *valuep,\n                     sb4            <span style=\"color:red\">value_sz<\/span>,\n                     ub2            dty,\n                     void          *indp,\n                     ub2           *alenp,\n                     ub2           *rcodep,\n                     ub4            maxarr_len,\n                     ub4           *curelep, \n                     ub4            mode );<\/code><\/pre>\n<p><span style=\"color:red\">value_sz<\/span> is the maximum size possible in bytes for the binding data, which is stored in *valuep. Basically, a developer can set value_sz to any value. I set <span style=\"color:red\">value_sz<\/span> to <span style=\"color:red\">90<\/span> and got the following entry in the SQL trace:<\/p>\n<pre><code> Bind#0\n  oacdty=01 <span style=\"color:red\">mxl<\/span>=2000(<span style=\"color:red\">267<\/span>) mxlc=00 mal=00 scl=00 pre=00\n  oacflg=00 fl2=1000000 frm=01 csi=873 siz=2000 off=0\n  kxsbbbfp=7f2923d0f920  bln=2000  avl=04  flg=05\n  value=\"AAAA\"<\/code><\/pre>\n<p>I passed <span style=\"color:red\">90<\/span>, but this value was transformed to <span style=\"color:red\">267<\/span>. 1 was subtracted from the original value <span style=\"color:red\">90<\/span> and then multiplied by 3. This behavior is somewhat consistent to what we saw in SQLPlus. This would mean that SQLPlus makes a similar call for binding values where it passes VARCHAR2 length (from the declaration)+1 as <span style=\"color:red\">value_sz<\/span>. As a consequence, the bind values can be assigned to wrong buckets that don&#8217;t match the actual data size.<\/p>\n<p>This inconsistency prompted me to inspect how different programming languages behave. I started with PL\/SQL.<\/p>\n<h1>PL\/SQL<\/h1>\n<p>I declared the bind variable as VARCHAR2(4000) and binded a <span style=\"color:red\">90<\/span> characters long VARCHAR2:<\/p>\n<pre><code>declare\n  l_n integer ;\n  l_v varchar2(4000);\nbegin\n  l_v := lpad('A',<span style=\"color:red\">90<\/span>,'A');\n  begin\n    select 1 into l_n from t where c = l_v;\n  exception when no_data_found then\n    null ;\n  end;\nend ;\n\/<\/code><\/pre>\n<p>Oracle uses the actual length of the data (<span style=\"color:red\">90<\/span>) for bucketizing:<\/p>\n<pre><code> Bind#0\n  oacdty=01 <span style=\"color:red\">mxl<\/span>=128(<span style=\"color:red\">90<\/span>) mxlc=00 mal=00 scl=00 pre=00\n  oacflg=13 fl2=206001 frm=01 csi=873 siz=128 off=0\n  kxsbbbfp=7f40ed211c88  bln=128  avl=90  flg=09\n  value=\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"<\/code><\/pre>\n<p>Two points are worth noting. One is that, unlike SQLPlus, the actual variable size instead of the size in the variable declaration is passed as the bind variable length (<span style=\"color:red\">mxl<\/span>). The other is, that, unlike in C, the actual size isn&#8217;t manipulated, so the value will be assigned to the bucket where it really belongs.<\/p>\n<p>The fact that the actual size is passed as the maximum value means that we should get multiple cursors created when binding values of different sizes. The following code binds the strings of lengths between 1 and 32767,<\/p>\n<pre><code>declare\n  l_n integer;\n  l_v varchar2(32767);\nbegin\n  for i in 1..32767\n  loop\n  \tl_v := lpad('A',i,'A');\n    begin\n      select 1 into l_n from t where c = l_v;\n\texception when no_data_found then\n\t  null;\n\tend;\n  end loop;\nend;\n\/<\/code><\/pre>\n<p>This yields several buckets with the following upper limits:<\/p>\n<pre><code>select datatype_string from v$sql_bind_capture where  sql_id = '85ff9tkukjsg0' ;\n\nDATATYPE_STRING\n------------------------------------------------------------\nVARCHAR2(32767)\nVARCHAR2(16386)\nVARCHAR2(8192)\nVARCHAR2(4000)\nVARCHAR2(2000)\nVARCHAR2(128)\nVARCHAR2(32)<\/code><\/pre>\n<p>In conclusion, there can be up to 7 child cursor for a query due to bind variable length changes.<\/p>\n<h1>Java<\/h1>\n<p>I did the same experiment in Java &#8211; binding the <span style=\"color:red\">90<\/span> characters long string and looking in SQL trace to see which maximum data length is used for binding.<\/p>\n<pre><code>import java.sql.*;\n\npublic class ExecutePreparedStatement4 {\n    public static void main(String[] argv) {\n        Connection con = null ;\n        try {\n            Class.forName(\"oracle.jdbc.driver.OracleDriver\");\n        } catch (ClassNotFoundException e) {\n            e.printStackTrace();\n            return;\n        }\n\n        try {\n            con = DriverManager.getConnection(\n                \"jdbc:oracle:thin:@ \" + argv[0], argv[1], argv[2]);\n            CallableStatement trace=con.prepareCall( \"{ call DBMS_MONITOR.session_trace_enable(waits=&gt;FALSE, binds=&gt;TRUE) }\" );\n            trace.execute();\n            trace.close();\n\n            String sql = \"select 1 from t where c = ?\";\n            PreparedStatement s = con.prepareStatement(sql);\n\n            String bindVar ;\n\n            bindVar = new String(new char[<span style=\"color:red\">90<\/span>]).replace('\\0', 'A');\n            s.setString(1,bindVar);\n            s.executeQuery();\n\n        } catch (SQLException e) {\n            e.printStackTrace();\n            return;\n        }\n    }\n}<\/code><\/pre>\n<pre><code> Bind#0\n  oacdty=01 <span style=\"color:red\">mxl<\/span>=2000(<span style=\"color:red\">360<\/span>) mxlc=00 mal=00 scl=00 pre=00\n  oacflg=03 fl2=1000010 frm=01 csi=873 siz=2000 off=0\n  kxsbbbfp=7f9e1ae28a18  bln=2000  avl=90  flg=05\n  value=\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"<\/code><\/pre>\n<p>The actual string length was multiplied by 4.<\/p>\n<h1>Python<\/h1>\n<p>Python behaves exactly like Java &#8211; it calculates the bind variable length by multiplying the actual length with 4:<\/p>\n<pre><code>import cx_Oracle\n\nconnection = cx_Oracle.connect(user=\"u\", password=\"Temp_1234\",\n                               dsn=\"DFEX5\",\n                               encoding=\"UTF-8\")\n\ncur = connection.cursor()\n\ncur.execute(\"begin DBMS_MONITOR.session_trace_enable(waits=&gt;FALSE, binds=&gt;TRUE); end;\");\ncur.execute(\"select 1 from t where c = :c1\", [\"A\" * <span style=\"color:red\">90<\/span><\/code>])<\/pre>\n<pre><code> Bind#0\n  oacdty=01 <span style=\"color:red\">mxl<\/span>=2000(<span style=\"color:red\">360<\/span>) mxlc=00 mal=00 scl=00 pre=00\n  oacflg=07 fl2=1000010 frm=01 csi=873 siz=2000 off=0\n  kxsbbbfp=7f74f187d930  bln=2000  avl=90  flg=05\n  value=\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"<\/code><\/pre>\n<h1>Summary<\/h1>\n<p>In summary, optimizer uses the size of the bind variable for deriving execution plans. The lengths are divided into 7 buckets with the following upper limits:<\/p>\n<pre><code>VARCHAR2(32767)\nVARCHAR2(16386)\nVARCHAR2(8192)\nVARCHAR2(4000)\nVARCHAR2(2000)\nVARCHAR2(128)\nVARCHAR2(32)<\/code><\/pre>\n<p>When the bind variable size changes, and the child cursor for this size doesn&#8217;t exist, the optimizer will create a new one.<\/p>\n<p>The term &#8220;bind variable size&#8221; is ambigous and programming language specific. It&#8217;s derived from the value which is specified in the binding OCI call. In C, an application programmer has the direct control over it and can set it to any value. 1 is subtracted from this value and than multiplied by 3. As a consequence, VARCHAR2 values can be assigned to wrong buckets.<\/p>\n<p>In higher level programming languages like Java and Python, this decision is taken away from the application developer &#8211; you can&#8217;t specify that value. They are set by language developers instead. It&#8217;s worth noting that the actual variable size is multiplied by 4, so also here the variables will be assigned to wrong buckets, but in a different manner than in C.<\/p>\n<p>In PL\/SQL there aren&#8217;t any manipulations on the bind variable length, so the bucketizing is most precise.<\/p>\n<p>Interestingly, SQLPlus developers decided to pass the variable size from the declaration as (incremented by 1) as opposed to the actual size, so unlike in C, PL\/SQL, Java and Python, new cursors won&#8217;t be generated if the data size changes as long as the declaration remains the same.<\/p>\n<p>As a consequence, optimizer can do different calculations for the same query in different programming languages. That&#8217;s good to be aware of if you&#8217;re porting an application to another language. Or, for example, if you&#8217;re testing your queries in SQLPlus, you might get different execution plans after you embed the the same query in the application code.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PL\/SQL, C, Python and Java handle bind variable length differently. As a consequence, different execution plans could be generated when the same query runs from different programming languages.<br \/>\n <a href=\"https:\/\/nenadnoveljic.com\/blog\/bind_variable_length\/\" class=\"more-link\">Continue Reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[11,5],"tags":[],"class_list":["post-4366","post","type-post","status-publish","format-standard","hentry","category-cost-based-optimizer","category-oracle"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Bind Variable Length in PL\/SQL, C, Java and Python - All-round Database Topics<\/title>\n<meta name=\"description\" content=\"PL\/SQL, C, Python and Java handle bind variable length differently. As a consequence, different execution plans could be generated when the same query runs from different programming languages.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/nenadnoveljic.com\/blog\/bind_variable_length\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Bind Variable Length in PL\/SQL, C, Java and Python - All-round Database Topics\" \/>\n<meta property=\"og:description\" content=\"PL\/SQL, C, Python and Java handle bind variable length differently. As a consequence, different execution plans could be generated when the same query runs from different programming languages.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/nenadnoveljic.com\/blog\/bind_variable_length\/\" \/>\n<meta property=\"og:site_name\" content=\"All-round Database Topics\" \/>\n<meta property=\"article:published_time\" content=\"2022-10-18T22:06:44+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-10-18T22:06:46+00:00\" \/>\n<meta name=\"author\" content=\"Nenad Noveljic\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@NenadNoveljic\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nenad Noveljic\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/bind_variable_length\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/bind_variable_length\\\/\"},\"author\":{\"name\":\"Nenad Noveljic\",\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/#\\\/schema\\\/person\\\/51458d9dd86dbbdd19f5add451d44efa\"},\"headline\":\"Bind Variable Length in PL\\\/SQL, C, Java and Python\",\"datePublished\":\"2022-10-18T22:06:44+00:00\",\"dateModified\":\"2022-10-18T22:06:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/bind_variable_length\\\/\"},\"wordCount\":1242,\"commentCount\":4,\"articleSection\":[\"cost based optimizer\",\"Oracle\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/bind_variable_length\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/bind_variable_length\\\/\",\"url\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/bind_variable_length\\\/\",\"name\":\"Bind Variable Length in PL\\\/SQL, C, Java and Python - All-round Database Topics\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/#website\"},\"datePublished\":\"2022-10-18T22:06:44+00:00\",\"dateModified\":\"2022-10-18T22:06:46+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/#\\\/schema\\\/person\\\/51458d9dd86dbbdd19f5add451d44efa\"},\"description\":\"PL\\\/SQL, C, Python and Java handle bind variable length differently. As a consequence, different execution plans could be generated when the same query runs from different programming languages.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/bind_variable_length\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/bind_variable_length\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/bind_variable_length\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Bind Variable Length in PL\\\/SQL, C, Java and Python\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/\",\"name\":\"All-round Database Topics\",\"description\":\"Nenad Noveljic\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/#\\\/schema\\\/person\\\/51458d9dd86dbbdd19f5add451d44efa\",\"name\":\"Nenad Noveljic\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a97b796613ea48ec8a7b79c8ffe1c685dcffc920c68121f6238d5caab5070670?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a97b796613ea48ec8a7b79c8ffe1c685dcffc920c68121f6238d5caab5070670?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a97b796613ea48ec8a7b79c8ffe1c685dcffc920c68121f6238d5caab5070670?s=96&d=mm&r=g\",\"caption\":\"Nenad Noveljic\"},\"sameAs\":[\"nenad-noveljic-9b746a6\",\"https:\\\/\\\/x.com\\\/NenadNoveljic\"],\"url\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/author\\\/nenad\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Bind Variable Length in PL\/SQL, C, Java and Python - All-round Database Topics","description":"PL\/SQL, C, Python and Java handle bind variable length differently. As a consequence, different execution plans could be generated when the same query runs from different programming languages.","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:\/\/nenadnoveljic.com\/blog\/bind_variable_length\/","og_locale":"en_US","og_type":"article","og_title":"Bind Variable Length in PL\/SQL, C, Java and Python - All-round Database Topics","og_description":"PL\/SQL, C, Python and Java handle bind variable length differently. As a consequence, different execution plans could be generated when the same query runs from different programming languages.","og_url":"https:\/\/nenadnoveljic.com\/blog\/bind_variable_length\/","og_site_name":"All-round Database Topics","article_published_time":"2022-10-18T22:06:44+00:00","article_modified_time":"2022-10-18T22:06:46+00:00","author":"Nenad Noveljic","twitter_card":"summary_large_image","twitter_creator":"@NenadNoveljic","twitter_misc":{"Written by":"Nenad Noveljic","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/nenadnoveljic.com\/blog\/bind_variable_length\/#article","isPartOf":{"@id":"https:\/\/nenadnoveljic.com\/blog\/bind_variable_length\/"},"author":{"name":"Nenad Noveljic","@id":"https:\/\/nenadnoveljic.com\/blog\/#\/schema\/person\/51458d9dd86dbbdd19f5add451d44efa"},"headline":"Bind Variable Length in PL\/SQL, C, Java and Python","datePublished":"2022-10-18T22:06:44+00:00","dateModified":"2022-10-18T22:06:46+00:00","mainEntityOfPage":{"@id":"https:\/\/nenadnoveljic.com\/blog\/bind_variable_length\/"},"wordCount":1242,"commentCount":4,"articleSection":["cost based optimizer","Oracle"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/nenadnoveljic.com\/blog\/bind_variable_length\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/nenadnoveljic.com\/blog\/bind_variable_length\/","url":"https:\/\/nenadnoveljic.com\/blog\/bind_variable_length\/","name":"Bind Variable Length in PL\/SQL, C, Java and Python - All-round Database Topics","isPartOf":{"@id":"https:\/\/nenadnoveljic.com\/blog\/#website"},"datePublished":"2022-10-18T22:06:44+00:00","dateModified":"2022-10-18T22:06:46+00:00","author":{"@id":"https:\/\/nenadnoveljic.com\/blog\/#\/schema\/person\/51458d9dd86dbbdd19f5add451d44efa"},"description":"PL\/SQL, C, Python and Java handle bind variable length differently. As a consequence, different execution plans could be generated when the same query runs from different programming languages.","breadcrumb":{"@id":"https:\/\/nenadnoveljic.com\/blog\/bind_variable_length\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/nenadnoveljic.com\/blog\/bind_variable_length\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/nenadnoveljic.com\/blog\/bind_variable_length\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/nenadnoveljic.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Bind Variable Length in PL\/SQL, C, Java and Python"}]},{"@type":"WebSite","@id":"https:\/\/nenadnoveljic.com\/blog\/#website","url":"https:\/\/nenadnoveljic.com\/blog\/","name":"All-round Database Topics","description":"Nenad Noveljic","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/nenadnoveljic.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/nenadnoveljic.com\/blog\/#\/schema\/person\/51458d9dd86dbbdd19f5add451d44efa","name":"Nenad Noveljic","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/a97b796613ea48ec8a7b79c8ffe1c685dcffc920c68121f6238d5caab5070670?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/a97b796613ea48ec8a7b79c8ffe1c685dcffc920c68121f6238d5caab5070670?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a97b796613ea48ec8a7b79c8ffe1c685dcffc920c68121f6238d5caab5070670?s=96&d=mm&r=g","caption":"Nenad Noveljic"},"sameAs":["nenad-noveljic-9b746a6","https:\/\/x.com\/NenadNoveljic"],"url":"https:\/\/nenadnoveljic.com\/blog\/author\/nenad\/"}]}},"_links":{"self":[{"href":"https:\/\/nenadnoveljic.com\/blog\/wp-json\/wp\/v2\/posts\/4366","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nenadnoveljic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nenadnoveljic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nenadnoveljic.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nenadnoveljic.com\/blog\/wp-json\/wp\/v2\/comments?post=4366"}],"version-history":[{"count":1,"href":"https:\/\/nenadnoveljic.com\/blog\/wp-json\/wp\/v2\/posts\/4366\/revisions"}],"predecessor-version":[{"id":4374,"href":"https:\/\/nenadnoveljic.com\/blog\/wp-json\/wp\/v2\/posts\/4366\/revisions\/4374"}],"wp:attachment":[{"href":"https:\/\/nenadnoveljic.com\/blog\/wp-json\/wp\/v2\/media?parent=4366"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nenadnoveljic.com\/blog\/wp-json\/wp\/v2\/categories?post=4366"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nenadnoveljic.com\/blog\/wp-json\/wp\/v2\/tags?post=4366"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}