Skip to Main Content

SQL & PL/SQL

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!

Unpersist package variables on the same anonymous block

user9098259Oct 17 2017 — edited Oct 20 2017

Hello,

I am trying to find a way to unpersist package variables on the same execution (can't use pragma SERIALLY_REUSABLE on package because I can't modify it).

The following is an example of what I am trying to do:

BEGIN

  DELETE tabla_1;

  COMMIT;

  global_package.variable_1:='hello';

  INSERT INTO tabla_1 (column_1) VALUES (global_package.variable_1);

  DBMS_SESSION.MODIFY_PACKAGE_STATE(1); --this is not working

  DBMS_SESSION.MODIFY_PACKAGE_STATE(2); --this is not working

  DBMS_SESSION.RESET_PACKAGE; -- this is not working

  --global_package.variable_1:=null; -- I can't use this because in the real application I have many unknown package variables.

  INSERT INTO tabla_1 VALUES (global_package.variable_1);

END;

/

SELECT *

FROM tabla_1;

The output is:

  column_1

----------

    hello

    hello

   

The desired output is:

  column_1

----------

    hello

    (null)

Thanks in advanced.

This post has been answered by Billy Verreynne on Oct 17 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 17 2017
Added on Oct 17 2017
24 comments
966 views