Ankur Kumar, November 12, 2019 - 3:25 pm UTC
create or replace package pkg
is
v_n number:=777;
End pkg;
/
Begin
pkg.v_n:=25;--Package is being used.
--But here package is not being used--
--Also no dbms_ouput.pu_line used in this anonymous block--
--since for me this package is not being used anymore
--the below line must drop this package but still I am
--unable to drop it.
--apart from me no one is using my package.
execute immediate 'drop package pkg';
End;
/
Thanks Chris for your response. Look I used dbms_ouput.put_line just to draft my question my real requirement does not use anything like this but still I have modified the code and now removed the dbms_ouput.put_line but still I am not able to drop the package within that anonymous block.
November 12, 2019 - 4:23 pm UTC
When you use an anonymous block, you're sending ONE statement to the database. So it's all part of the same call.
If you reference the package anywhere in the block, it's still part of the statement. So you can't drop the package in that block.
You must split package access and drop into two separate blocks.