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!

How this context switch is happening?

BS2012Dec 22 2014 — edited Dec 22 2014

Hi Everyone,

Please go through the link below and clear my doubt.

https://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:60122715103602

Then we can say, if there is a SQL query inside a PLSQL block, then for that SQL query; SQL engine will come into the picture and PLSQL engine will take care of the procedural code. Am I right here?

If this is true, then can someone enlighten me about "what is happening inside, and how this automated process works? And of course how Oracle will deal with this context switch? "

Do we have flow chart or diagram related to this?

Please do have a look at the sample code and let me know when the context switch will happen?

CREATE TABLE BS_TEST (ID NUMBER(4));

DECLARE

    VN_NUM NUMBER(4);

BEGIN

  SELECT MAX(ID) INTO VN_NUM FROM BS_TEST;

 

  VN_NUM := NVL(VN_NUM, '0');

 

  FOR I IN 1..1000

  LOOP

    VN_NUM := VN_NUM + 1;

    INSERT INTO BS_TEST VALUES (VN_NUM);

  END LOOP;

END;

/

Regards,

BS2012.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 19 2015
Added on Dec 22 2014
5 comments
1,537 views