Which three statements are true about anonymous blocks and subprograms?

Which three statements are true about anonymous blocks and subprograms? (Choose three.)

Which three statements are true about anonymous blocks and subprograms? (Choose three.)

A.
Only subprograms can be parameterized.

B.
Only subprograms are persistent database objects.

C.
Both anonymous blocks and subprograms can be parameterized.

D.
Both anonymous blocks and subprograms are persistent database objects

E.
Only subprograms can return values that persist after the execution of the subprogram.

F.
Both anonymous blocks and subprograms can return values that persist In SQL*Plus variables
after their execution.



Leave a Reply 22

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


Uladzimir

Uladzimir

A B F

E is incorrect. see sample below for SQL PLUS:

variable num number;
begin
:num := 1;
end;
/
print :num;
—> 1

Leo Yu

Leo Yu

But host variable num is client variable can not persist

Uladzimir

Uladzimir

EDIT: B, C, F

A is incorrect.
Because of the sample below (sql plus):

Begin
dbms_output.put_line (&param);
end;
/
Enter value for param: 5
old 2: dbms_output.put_line (&param);
new 2: dbms_output.put_line (5);

PL/SQL procedure successfully completed.

mkurko

mkurko

A is correct. In your example you do not pass parameter to block but block read the parameter from somewhere.

Fabio

Fabio

I can’t get it.

No A and No C. So what’s the truth about parameters?

I think it should be A, B, E, F…

lol

Fabio

Fabio

Ok show answer just give shit result.

Bcf

Khizar

Khizar

Ans : A,B,E

pablox_co

pablox_co

A, B, F

pablox_co

pablox_co

B, C, F

andres

andres

oigan a este

dudeman

dudeman

A,B, and E.

Nat

Nat

Host- and bindvariables are never called parameters or return values in the ORACLE-Doc.
So it’s
A B E
!

giosefer

giosefer

ABF sure!

The Reason for answer is the following: https://docs.oracle.com/cd/B19306_01/server.102/b14357/ch5.htm#i1211850
================================================================================
Example 5-15 Using REFCURSOR Variables in Stored Procedures

A REFCURSOR bind variable is passed as a parameter to a procedure. The parameter has a REF CURSOR type. First, define the type.

CREATE OR REPLACE PACKAGE EmpPack AS
TYPE EmpInfoTyp IS REF CURSOR;
PROCEDURE EmpInfoRpt (emp_cv IN OUT EmpInfoTyp);
END EmpPack;
/
Package created.

Next, create the stored procedure containing an OPEN… FOR SELECT statement.

CREATE OR REPLACE PACKAGE BODY EmpPack AS
PROCEDURE EmpInfoRpt (emp_cv IN OUT EmpInfoTyp) AS
BEGIN
OPEN emp_cv FOR SELECT EMPLOYEE_ID, SALARY
FROM EMP_DETAILS_VIEW
WHERE JOB_ID=’SA_MAN’ ;
END;
END;
/
Procedure created.

Execute the procedure with a SQL*Plus bind variable as the parameter.

VARIABLE cv REFCURSOR
EXECUTE EmpPack.EmpInfoRpt(:cv)
PL/SQL procedure successfully completed.

Now print the bind variable.

PRINT cv
EMPLOYEE_ID SALARY
———– ———-
145 14000
146 13500
147 12000
148 11000
149 10500

====================================================

In this example the subprograms “EmpInfoRpt” return values that persist In SQL*Plus variables “cv”.

100% F! 🙂

Vb

Vb

IT’S B,C,F

giosefer

giosefer

no, ABF.

giosefer

giosefer

Only subprogram can accept parameters (I read the book of M. Morris – Study Guide For 1Z0-144)