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.
A, B, E
A B F
E is incorrect. see sample below for SQL PLUS:
variable num number;
begin
:num := 1;
end;
/
print :num;
—> 1
But host variable num is client variable can not persist
EDIT: B, C, F
A is incorrect.
Because of the sample below (sql plus):
Begin
dbms_output.put_line (¶m);
end;
/
Enter value for param: 5
old 2: dbms_output.put_line (¶m);
new 2: dbms_output.put_line (5);
PL/SQL procedure successfully completed.
A is correct. In your example you do not pass parameter to block but block read the parameter from somewhere.
a,b,f
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
Ok show answer just give shit result.
Bcf
BCF
Ans : A,B,E
A, B, F
B, C, F
oigan a este
B,C,F
A,B, and E.
B, C, F
Host- and bindvariables are never called parameters or return values in the ORACLE-Doc.
So it’s
A B E
!
??
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! 🙂
IT’S B,C,F
no, ABF.
Only subprogram can accept parameters (I read the book of M. Morris – Study Guide For 1Z0-144)