Which two statements are true about the above function?

Examine the following code:

Which two statements are true about the above function? (Choose two.)

Examine the following code:

Which two statements are true about the above function? (Choose two.)

A.
It can be used only in a parallelized query.

B.
It can be used in both a parallelized query and a parallelized DML statement.

C.
It can be used only in a parallelized data manipulation language (DML) statement.

D.
It can have a separate copy run in each of the multiple processes when called from a SQL
statement that is run in parallel.

E.
It requires a PRAGMA RESTRICT_REFERENCES declaration with RNDS, WNDS, RNPS, and
WNPS specified in order to use parallel optimization.



Leave a Reply 17

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


Vladimir

Vladimir

B D

1) A RESTRICT_REFERENCES pragma can appear ONLY IN A PACKAGE SPECIFICATION or object type specification. Typically, this pragma is specified for functions. If a function calls procedures, specify the pragma for those procedures also.

2) The RESTRICT REFERENCES pragma is deprecated. Oracle recommends using DETERMINISTIC and PARALLEL_ENABLE (described in Function Declaration and Definition) instead of RESTRICT REFERENCES.

http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/restrictreferences_pragma.htm#LNPLS01339

User

User

Parallel enabled table functions can improve performance by sharing their workload between slave processes.
To parallel enable a function, it must internally define a method for partitioning the workload,
and the following conditions must be met:

The function must include a PARALLEL_ENABLE clause.

The basic syntax for a parallel enabled table function is-

CREATE FUNCTION function-name(parameter-name ref-cursor-type)
RETURN rec_tab_type PIPELINED
PARALLEL_ENABLE(PARTITION parameter-name BY [{HASH | RANGE} (column-list) | ANY ]) IS
BEGIN

END;

To be callable from SQL statements, a stored function must obey certain “purity” rules, which control side-effects.
(See “Controlling Side Effects of PL/SQL Subprograms”.)
The fewer side-effects a function has, the better it can be optimized within a query,
particular when the PARALLEL_ENABLE or DETERMINISTIC hints are used.
The same rules that apply to the function itself also apply to any functions or procedures that it calls.
If any SQL statement inside the function body violates a rule,
you get an error at run time (when the statement is parsed).
To check for violations of the rules at compile time,
you can use the compiler directive PRAGMA RESTRICT_REFERENCES.
This pragma asserts that a function does not read and/or write database tables and/or package variables.
Functions that do any of these read or write operations are difficult to optimize,
because any call might produce different results or encounter errors.
For more information, see Oracle Database Application Developer’s Guide – Fundamentals.

DEFAULT
Specifies that the pragma applies to all subprograms in the package spec or object type spec. You can still declare the pragma for individual subprograms. Such pragmas override the default pragma.

function_name
A user-defined function or procedure.

PRAGMA
Signifies that the statement is a compiler directive. Pragmas are processed at compile time, not at run time. They do not affect the meaning of a program; they convey information to the compiler.

RNDS
Asserts that the subprogram reads no database state (does not query database tables).

RNPS
Asserts that the subprogram reads no package state (does not reference the values of packaged variables)

TRUST
Asserts that the subprogram can be trusted not to violate one or more rules. This value is needed for functions written in C or Java that are called from PL/SQL, since PL/SQL cannot verify them at run time.

WNDS
Asserts that the subprogram writes no database state (does not modify database tables).

WNPS
Asserts that the subprogram writes no package state (does not change the values of packaged variables).

User

User

Parallel query require the function to NOT read or write data from external sources such as packages or tables.

User

User

Therefore E is correct

alex

alex

PRAGMA RESTRICT_REFERENCES are deprecate, so E is not correct.

Usert

Usert

That was needed until Oracle 8i

Alisa

Alisa

Parallel query require the function to NOT read or write data from external sources such as packages or tables.

swamy

swamy

Parallel query – When the parallel servers are finished executing the statement, the query coordinator performs any portion of the work that cannot be executed in parallel. For example, a parallel query with a SUM() operation requires adding the individual subtotals calculated by each parallel server.

ksvn

ksvn

Answers are very confusing.Which one is the correct answer?

Thanks