Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Changing function show effect only after re-connect

Franck PachotMar 16 2019 — edited Apr 10 2019

Hi MLE team,

It seems that if we change the function behaviour (with create or replace) the already connected users do not run the new code until they reconnect.

Here is an example (from this which I wrote for PI-Day: https://medium.com/@FranckPachot/oracle-multi-lingual-engine-7ce6414aa6c4

SQL>  grant dba to demo identified by demo;

Grant succeeded.

SQL>  connect demo/demo@//localhost/pdb1

Connected.

SQL>

SQL> connect demo/demo@//localhost/pdb1

Connected.

SQL> create javascript source named "test1.js" as

  2  module.exports.PI=function (d) {

  3   return Math.round(10**d*Math.PI)/10**d;

  4  }

  5  /

Function ( compiled

SQL> create function PI(decimals in number)

  2  return number as language javascript

  3  name 'test1\.js.PI(decimals number) return number';

  4  /

Function PI compiled

SQL> select PI(2) from dual;

     PI(2)

----------

      3.14

SQL>

SQL>

SQL> create or replace javascript source named "test1.js" as

  2  module.exports.PI=function (d) {

  3   return 1+Math.round(10**d*Math.PI)/10**d;

  4  }

  5  /

Function null compiled

SQL> create or replace function PI(decimals in number)

  2  return number as language javascript

  3  name 'test1\.js.PI(decimals number) return number';

  4  /

Function PI compiled

SQL> select PI(2) from dual;

     PI(2)

----------

      3.14

SQL> connect demo/demo@//localhost/pdb1

Connected.

SQL> select PI(2) from dual;

     PI(2)

----------

      4.14

I have changed the code (create or replace javascript source) to add one to the result, and recompiled the function (create or replace function). Next execution has executed the old code. After re-connect I run the new code.

Regards,

Franck.

Regards,

Franck.

Comments

Mike Kutz

I wish there was a date for "Last updated" on the one site.

It looks like this is (now) a Known Issue (3rd bullet point)

https://oracle.github.io/oracle-db-mle/release_notes/

That "Last updated" would have told me if you (re)discovered this bug or not.  (were you the one that caused them to add that bullet point or did the MLE team already know about it?)

1 - 1

Post Details

Added on Mar 16 2019
1 comment
305 views