<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Sets the database edition</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.oci-set-client-info.html">oci_set_client_info</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.oci-set-module-name.html">oci_set_module_name</a></div> <div class="up"><a href="ref.oci8.html">OCI8 Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.oci-set-edition" class="refentry"> <div class="refnamediv"> <h1 class="refname">oci_set_edition</h1> <p class="verinfo">(PHP 5.3.2, PECL OCI8 >= 1.4.0)</p><p class="refpurpose"><span class="refname">oci_set_edition</span> — <span class="dc-title">Sets the database edition</span></p> </div> <div class="refsect1 description" id="refsect1-function.oci-set-edition-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">bool</span> <span class="methodname"><strong>oci_set_edition</strong></span> ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$edition</code></span> )</div> <p class="para rdfs-comment"> Sets the database "edition" of objects to be used by a subsequent connections. </p> <p class="para"> Oracle Editions allow concurrent versions of applications to run using the same schema and object names. This is useful for upgrading live systems. </p> <p class="para"> Call <span class="function"><strong>oci_set_edition()</strong></span> before calling <span class="function"><a href="function.oci-connect.html" class="function">oci_connect()</a></span>, <span class="function"><a href="function.oci-pconnect.html" class="function">oci_pconnect()</a></span> or <span class="function"><a href="function.oci-new-connect.html" class="function">oci_new_connect()</a></span>. </p> <p class="para"> If an edition is set that is not valid in the database, connection will fail even if <span class="function"><strong>oci_set_edition()</strong></span> returns success. </p> <p class="para"> When using persistent connections, if a connection with the requested edition setting already exists, it is reused. Otherwise, a different persistent connection is created </p> </div> <div class="refsect1 parameters" id="refsect1-function.oci-set-edition-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">edition</code></em></span> <dd> <p class="para"> Oracle Database edition name previously created with the <acronym>SQL</acronym> "<em>CREATE EDITION</em>" command. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 notes" id="refsect1-function.oci-set-edition-notes"> <h3 class="title">Notes</h3> <blockquote class="note"><p><strong class="note">Note</strong>: <strong>Oracle version requirement</strong><br /> <p class="para"> This function is available from Oracle 11<em class="emphasis">g</em>R2 onwards. </p> </p></blockquote> <div class="caution"><strong class="caution">Caution</strong> <h1 class="title">Persistent connections</h1> <p class="para"> To avoid inconsistencies and unexpected errors, do not use ALTER SESSION SET EDITION to change the edition on persistent connections. </p> </div> <div class="caution"><strong class="caution">Caution</strong> <h1 class="title">DRCP Connection Pooling</h1> <p class="para"> To avoid inconsistencies and unexpected errors when using editions and <a href="oci8.connection.html" class="link">DRCP</a> with Oracle 11.2.0.1, keep a one-to-one correspondence between the <a href="oci8.configuration.html#ini.oci8.connection-class" class="link">oci8.connection_class</a> and the edition name used by applications. Each pooled server of a given connection class should only be used with one edition. This restriction has been removed with Oracle 11.2.0.2. </p> </div> </div> <div class="refsect1 returnvalues" id="refsect1-function.oci-set-edition-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns <strong><code>TRUE</code></strong> on success or <strong><code>FALSE</code></strong> on failure. </p> </div> <div class="refsect1 examples" id="refsect1-function.oci-set-edition-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-2025"> <p><strong>Example #1 Two scripts can use different versions of myfunc() at the same time</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /><br /></span><span style="color: #FF8000">// File 1<br /><br /></span><span style="color: #007700">echo </span><span style="color: #DD0000">"Version 1 of application\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">oci_set_edition</span><span style="color: #007700">(</span><span style="color: #DD0000">'ORA$BASE'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$c </span><span style="color: #007700">= </span><span style="color: #0000BB">oci_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">'hr'</span><span style="color: #007700">, </span><span style="color: #DD0000">'welcome'</span><span style="color: #007700">, </span><span style="color: #DD0000">'localhost/XE'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$s </span><span style="color: #007700">= </span><span style="color: #0000BB">oci_parse</span><span style="color: #007700">(</span><span style="color: #0000BB">$c</span><span style="color: #007700">, </span><span style="color: #DD0000">"begin :r := myfunc(); end;"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">oci_bind_by_name</span><span style="color: #007700">(</span><span style="color: #0000BB">$s</span><span style="color: #007700">, </span><span style="color: #DD0000">":r"</span><span style="color: #007700">, </span><span style="color: #0000BB">$r</span><span style="color: #007700">, </span><span style="color: #0000BB">20</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">oci_execute</span><span style="color: #007700">(</span><span style="color: #0000BB">$s</span><span style="color: #007700">);<br />echo </span><span style="color: #DD0000">"The result is </span><span style="color: #0000BB">$r</span><span style="color: #DD0000">\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /><br /></span><span style="color: #FF8000">// File 2<br /><br /></span><span style="color: #007700">echo </span><span style="color: #DD0000">"Version 2 of application\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">oci_set_edition</span><span style="color: #007700">(</span><span style="color: #DD0000">'E1'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$c </span><span style="color: #007700">= </span><span style="color: #0000BB">oci_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">'hr'</span><span style="color: #007700">, </span><span style="color: #DD0000">'welcome'</span><span style="color: #007700">, </span><span style="color: #DD0000">'localhost/XE'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$s </span><span style="color: #007700">= </span><span style="color: #0000BB">oci_parse</span><span style="color: #007700">(</span><span style="color: #0000BB">$c</span><span style="color: #007700">, </span><span style="color: #DD0000">"begin :r := myfunc(); end;"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">oci_bind_by_name</span><span style="color: #007700">(</span><span style="color: #0000BB">$s</span><span style="color: #007700">, </span><span style="color: #DD0000">":r"</span><span style="color: #007700">, </span><span style="color: #0000BB">$r</span><span style="color: #007700">, </span><span style="color: #0000BB">20</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">oci_execute</span><span style="color: #007700">(</span><span style="color: #0000BB">$s</span><span style="color: #007700">);<br />echo </span><span style="color: #DD0000">"The result is </span><span style="color: #0000BB">$r</span><span style="color: #DD0000">\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> </div> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.oci-set-client-info.html">oci_set_client_info</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.oci-set-module-name.html">oci_set_module_name</a></div> <div class="up"><a href="ref.oci8.html">OCI8 Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>