Changing function show effect only after re-connect — oracle-tech

    Forum Stats

  • 3,702,305 Users
  • 2,239,629 Discussions
  • 7,835,899 Comments

Discussions

Changing function show effect only after re-connect

Franck PachotFranck Pachot Posts: 912 Bronze Trophy
edited April 2019 in Multilingual Engine

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/[email protected]//localhost/pdb1

Connected.

SQL>

SQL> connect demo/[email protected]//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/[email protected]//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.

Answers

  • Mike KutzMike Kutz Posts: 5,548 Silver Crown
    edited April 2019

    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?)

Sign In or Register to comment.