What is the outcome?

View the Exhibit and examine the package code created by SCOTT. The execute privilege on this
package is granted to green.

Examine the following sequence of commands issued by SCOTT:

What is the outcome?

View the Exhibit and examine the package code created by SCOTT. The execute privilege on this
package is granted to green.

Examine the following sequence of commands issued by SCOTT:

What is the outcome?

A.
SCOTT’S session displays 5, and then 0, greets session displays 0.

B.
SCOTT’S session displays 5, and then 0; green’s session displays 5.

C.
SCOTT’S session displays 5, and then 5 again, green’s session displays 0.

D.
SCOTT’S session displays 5, and then 5 again; green’s session displays 5.



Leave a Reply 32

Your email address will not be published. Required fields are marked *


Vladimir

Vladimir

A

When the call to the server ends, the memory is returned to the pool. Each time the package is reused, its public variables are initialized to their default values or to NULL.

every execute is a new server call, thus “http://docs.oracle.com/cd/B12037_01/appdev.101/b10807/13_elems046.htm”

http://docs.oracle.com/cd/B12037_01/appdev.101/b10807/13_elems046.htm

Sufiyan

Sufiyan

what about green session??

Vladimir

Vladimir

edit:
every execute is a new server call, thus “public variables are initialized to their default values”

Tr

Tr

Yes, it’s A.

tested:
PL/SQL procedure successfully completed.

Num: 5

PL/SQL procedure successfully completed.

Num: 0

sud

sud

Hey Vladimir, where did you get this info “every execute is a new server call”?

Fabio

Fabio

In a package variable life cycle is per session.

I think he means that each exec open a new session. That’s why we got 5 and 0. => the right answere is A.

Sufiyan

Sufiyan

What about green session?
AND Y?

User

User

The pragma SERIALLY_REUSABLE indicates that the package state is needed only for the duration of one call to the server.

Leo Yu

Leo Yu

Help:
Serially reusable packages cannot be accessed from database triggers or other PL/SQL subprograms that are called from SQL statements. If you try, Oracle generates an error.
Why subprogram called from SQL or trigger cannot make use of the subprogram with PRAMA SERIALLY_REUSEABLE?

palvch

palvch

A is correct.

http://docs.oracle.com/cd/B12037_01/appdev.101/b10807/13_elems046.htm

CREATE or REPLACE PACKAGE z_test_pkg1 IS
PRAGMA SERIALLY_REUSABLE;
num NUMBER := 0;
PROCEDURE init_pkg_state(n NUMBER);
PROCEDURE print_pkg_state;
END z_test_pkg1;
/

CREATE or REPLACE PACKAGE BODY z_test_pkg1 IS
PRAGMA SERIALLY_REUSABLE;
PROCEDURE init_pkg_state (n NUMBER) IS
BEGIN
z_test_pkg1.num := n;
dbms_output.put_line(‘Num: ‘ || z_test_pkg1.num);
END;
PROCEDURE print_pkg_state IS
BEGIN
dbms_output.put_line(‘Num: ‘ || z_test_pkg1.num);
END;
END z_test_pkg1;
/

——————————————————————————
——————————————————————————

SQL> SET SERVEROUTPUT ON
SQL> EXEC z_test_pkg1.init_pkg_state(5);

Num: 5

PL/SQL procedure successfully completed

SQL> EXEC z_test_pkg1.print_pkg_state;

Num: 0

PL/SQL procedure successfully completed

Google

Google

Please go to the internet sites we comply with, such as this 1, as it represents our picks in the web.

Google

Google

Please visit the websites we stick to, which includes this a single, as it represents our picks from the web.

Google

Google

Usually posts some very interesting stuff like this. If youre new to this site.

Play online games

Play online games

Every after in a whilst we opt for blogs that we study. Listed beneath are the most recent web-sites that we choose

satta matka

satta matka

usually posts some quite exciting stuff like this. If you are new to this site

Lava building products

Lava building products

although web sites we backlink to beneath are considerably not related to ours, we really feel they may be truly worth a go by, so possess a look

how to create an app for free

how to create an app for free

Wonderful story, reckoned we could combine some unrelated data, nonetheless genuinely worth taking a appear, whoa did one study about Mid East has got much more problerms too

Pinganillos

Pinganillos

Sites of interest we’ve a link to

how to create an app

how to create an app

always a massive fan of linking to bloggers that I love but dont get a whole lot of link appreciate from

app builder

app builder

the time to study or visit the subject material or web-sites we’ve linked to beneath the

create app

create app

Here is an excellent Blog You may Discover Interesting that we Encourage You