What correction should be performed in the above code?

Examine the following code that you plan to execute:

What correction should be performed in the above code?

Examine the following code that you plan to execute:

What correction should be performed in the above code?

A.
The PROC2 procedure code should be defined in the package body.

B.
The PROC3 procedure should be declared in the package specification.

C.
The PROC3 procedure header should be declared at the beginning of the package body.

D.
The variable x must be declared in the package body and removed from the specification,



Leave a Reply 22

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


Uladzimir

Uladzimir

A — MUST (compile error)
B — optional

alex

alex

This is not an easy one.
1) PROC2 must be defined in the package body otherwise it will give an error at compilation.

2) PROC3 does not need to be in the specification, but if he is not invoked by other function or procedure in the package he will never be accessible. For what we see in the excerpt available PROC3 is not being invoked anywhere else. So I tend to agree that PROC3 should go to the specification.

3) Regarding the variable X, it only should go to the body if we create a GET function, which is not the case, so it should remain in the specification.

I would say that the correct answer is A and B.

Ayaz Gillani

Ayaz Gillani

The correct answers are:
A,D

Error(3,11): PLS-00323: subprogram or cursor ‘PROC2’ is declared in a package specification and must be defined in the package body

Error(4,1): PLS-00201: identifier ‘X’ must be declared.

Thank you!

Ayaz Gillani

Ayaz Gillani

Sorry, the correct answers is only:

A

tal

tal

DUMBS says A,B
BUT
i agree with A, but i didn’t have any compilation errors as someone said (Oracle 11g)

B – it can be local procedures but locals usually in the begining.
SO MAYBE we should declare it in spec.

C – if its local then better put this procedure in header, but NOT NESSESARY

D – is bull***t

SO looks like it could be A, AB, AC

Vitaly

Vitaly

“A”

The question is “What correction ***SHOULD BE*** performed?”.
And the only correct answer is “A”.

Alisa

Alisa

B is incorrect. If subprogram (proc3) exists in the package body that are not declared in the package specification, then its is private and can only be referenced from INSIDE the package body.

palvch

palvch

A is correct.

SK

SK

create or replace
package BODy p1 is
PROCEDURE proc1 is
begin
x:=1;
end;
procedure proc3 is
begin
dbms_output.put_line(x);
end proc3;

procedure proc2 is
begin
proc1();
end proc2;
end p1;

AS PROC2 is not defined in the package we can not assume, that it wont be used by proc2..

Bruno

Bruno

You can only choose one answer, which is A.

Ferraz

Ferraz

i done the exame today, and this question had just one answer.
that was A

alex

alex

Thanks Ferraz 🙂

Arivoli

Arivoli

Super. Then Answer is A – Final.