What correction should be performed in the above code?

Examine the following code that you plan to execute:
(Exhibit)

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 17

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


william

william

B is wrong.
A procedure in the body but not in the specification is just a private procedure and it’s completely valid. If you want two answers, then choose A & C, since if you try to reference PROC3 before it’s declaration you’ll get an error, or use forward declaration.

howard

howard

answer is A only.

qaisarimtiaz

qaisarimtiaz

Yes Answer is “A”

Zaheer Nazir

Zaheer Nazir

The answer should be AB.
Because question is What correction should be performed in the above code?

SP

SP

Answer is A only.

JFlorezH

JFlorezH

Answer is A because a package can have a Procedure only in Body section and it will be Privated, but if you declare a procedure on Specification of Package it must be implemented on Body Section. (Sorry about my english)

Aarti

Aarti

A is correct ans. For successful compilation of the code, proc2 which is declared in package specification must be defined in package body.

P0

P0

Yep, only A is correct answer.

PLS-00323
Error Description:
Subprogram or cursor “string” is declared in a package specification and *must* be defined in the package body.

B is wrong there could be procedure/function in body without declaration in specification. C could be done, but it’s not required. D is obviously wrong.

Frederick Johnson

Frederick Johnson

Both A and B. For B, true the procedure is valid but it’s useless unless it’s either declared under the package specification or a publicly available procedure such as PROC1 is calling PROC3 from within the package body.

Frederick Johnson

Frederick Johnson

And the reason D is wrong is because proc1 runs first and x is assigned the value of 1 before proc3 follows after that.

VJ

VJ

PLS-00323: subprogram or cursor ‘PROC2’ is declared in a package
specification and must be defined in the package body

Ritam

Ritam

if the proc3 proc is not defined inside the pkg spec then it is called as a PRIVATE PROCEDURE!!!

Ritam

Ritam

its called Information hiding