Which two tasks should be created as functions instead of as procedures? (Choose two.)
A.
Reference host or bind variables in a PL7SQL blockof code
B.
Tasks that compute and return multiple values to the calling environment
C.
Tasks that compute a value that must be returned to the calling environment
D.
Tasks performed in SQL that increase data independence by processing complex data analysis
within the Oracle server, rather than by retrieving the data into an application
Explanation:
Explanation/Reference:
Functions are used to return a value. Functions must return only a single value.
Procedure are used to perform an action.
Both functions and procedures are using to do a special task or action. In functions it is must to
return a single value, where as in procedures it’s not compulsory
C D
D C
A, C
I doubt in D:
1) How do functions can increase data independence?
2) “rather than by retrieving the data in to application”.
I suggest that function need to retrieve data into application… and word “rather” in this andwer point out to the mistake…
EDIT: C, D
C, D
A is incorrect we can reference to host/bing variables throught functions and procedures
Tomas Kyte
and we said…
A bind variable is an INPUT into the query you provide.
A host variable is where you put your data.
https://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1063759517155
C and D
C and D
Answer is C & D
A is incorrect
create or replace function f1
return number
as
z number := 0;
begin
z := 😡 + :y;
return z;
exception when others then
dbms_output.put_line(sqlerrm);
end;
———————————
Compilation failed,line 6 (12:40:44)
PLS-00049: bad bind variable ‘X’Compilation failed,line 6 (12:40:44)
PLS-00049: bad bind variable ‘Y’
C,D
cd