Sunday, 15 September 2013

oracle - Why execution of this block never ends? -


Assume that we have a package pack

  package pack is process; End pack; Package body pack process is DBMS_OUTPUT.PUT_LINE ('From hello pack'); End; End pack;  

Why the block is executed

  Start PACK.do; Immediate execution of package package; End;  

Never Ended (Session Hangs)? However, different performance of the first and second lines (in separate anonymous blocks) is successful.

The package is being used, that means its a example Still active, therefore, until it has not been killed, you can not change your situation.

When a process or a stored function is implemented, then the lock is acquired on that object state. Until the collar module does not complete, the lock will remain active.

In your case, you are trying to change the package to the same PL / SQL block which is called it. The result is with deadlock . PL / SQL is trying to execute its DDL dynamically, but it is already locked when the package is called for the first time!

Please note that the same PL / SQL can still call the package after this dynamic DLL (it can also be DROP !). Therefore, for continuation, the lock is not released until the whole PL / SQL is completed!

  ORA-04021: Time is waiting for the object to lock.  

From where, when you calls in the PL / SQL block, the lock will be already released. Before implementing DDL.

This is trying to run SQL in a different session.

  select from v $ access * object = 'pack';  

No comments:

Post a Comment