1

Which two tasks should be created as functions instead of as procedures? (Choose two.)

A.reference host or bind variables in a PL7SQL block of 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.

whats the answer

and can we reference host or bind variable in function or procedure ?

2 Answers 2

2

Well, let's see:

A. Reference host or bind variables in a PL/SQL block of code - both procedures and functions can accept bound variables from host code, so this applies to both.

B. Tasks that compute and return multiple values to the calling environment - both procedures and function can do this via OUT parameters, so this also applies to both.

C. Tasks that compute a value that must be returned to the calling environment - both procedures and functions can do this (procedures can use OUT parameters), thus again this applies to both - although the use of the word "returned" in the question suggests that the writer meant "returns a value through the use of the RETURN keyword" so let's give this one to functions only and ignore the fact that we know better.

D. Tasks performed in SQL that increase data independence...blah-blah-blah... - I'm going with functions on this one, as an SQL statement can only call a function, not a procedure - plus, I have to choose two answers so this has got to be one of them since the first two are obviously not attributes of functions ONLY.

So, C and D.

How'd I do? :-)

Share and enjoy.

Sign up to request clarification or add additional context in comments.

1 Comment

THANKS BUT WE CANT REFERENCE BIND VARIABLE IN THE HEADER I MEAN IN THE DEFINITION ? @Bob jarvis
1

Function is required when a value must be returned to the calling environment and/or when it is expected to be used in queries. Procedure can't do either of those.

1 Comment

+1. To be didactic, procedures CAN return values through OUT parameters but even then they still can't be used in an SQL statement.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.