exam questions

Exam 1z0-148 All Questions

View all questions & answers for the 1z0-148 exam

Exam 1z0-148 topic 1 question 11 discussion

Actual exam question from Oracle's 1z0-148
Question #: 11
Topic #: 1
[All 1z0-148 Questions]

Examine this function header:
FUNCTION calc_new_sal (emp_id NUMBER) RETURN NUMBER;
You want to ensure that whenever this PL/SQL function is invoked with the same parameter value across active sessions, the result is not recomputed.
If a DML statement is modifying a table which this function depends upon, the function result must be recomputed at that point in time for all sessions calling this function.
Which two actions should you perform?

  • A. Ensure RESULT_CACHE_MAX_SIZE is greater than 0.
  • B. Enable the result cache by using DBMS_RESULT_CACHE.BYPASS (FALSE).
  • C. Add the deterministic clause to the function definition.
  • D. Add the RELIES_ON clause to the function definition.
  • E. Add the RESULT_CACHE clause to the function definition.
Show Suggested Answer Hide Answer
Suggested Answer: AC 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
yurijk
Highly Voted 5 years ago
A and E
upvoted 5 times
...
Angelos_ang
Most Recent 2 years, 4 months ago
Selected Answer: AE
RELIES_ON is deprecated. As of Oracle Database 12c, the database detects all data sources that are queried while a result-cached function is running, and RELIES_ON clause does nothing. https://docs.oracle.com/en/database/oracle/oracle-database/19/lnpls/RESULT_CACHE-clause.html#GUID-7B0FFFDF-C953-46E5-9FD6-C41DFBDE1B0B
upvoted 1 times
...
Rakeshpro
2 years, 4 months ago
To make a function result-cached, include the RESULT_CACHE clause in the function definition. If you declare the function before defining it, you must also include the RESULT_CACHE option in the function declaration.
upvoted 1 times
Rakeshpro
2 years, 4 months ago
RELIES_ON: Specifies the data sources on which the results of the function depend. Each data_source is the name of either a database table or view.
upvoted 1 times
Rakeshpro
2 years, 4 months ago
CREATE OR REPLACE PACKAGE department_pkg AUTHID DEFINER IS TYPE dept_info_record IS RECORD ( dept_name departments.department_name%TYPE, mgr_name employees.last_name%TYPE, dept_size PLS_INTEGER ); -- Function declaration FUNCTION get_dept_info (dept_id NUMBER) RETURN dept_info_record RESULT_CACHE; END department_pkg; / CREATE OR REPLACE PACKAGE BODY department_pkg IS -- Function definition FUNCTION get_dept_info (dept_id NUMBER) RETURN dept_info_record RESULT_CACHE IS rec dept_info_record; BEGIN SELECT department_name INTO rec.dept_name FROM departments WHERE department_id = dept_id; SELECT e.last_name INTO rec.mgr_name FROM departments d, employees e WHERE d.department_id = dept_id AND d.manager_id = e.employee_id; SELECT COUNT(*) INTO rec.dept_size FROM EMPLOYEES WHERE department_id = dept_id; RETURN rec; END get_dept_info; END department_pkg; /
upvoted 1 times
Rakeshpro
2 years, 4 months ago
http://www.dba-oracle.com/t_rac_tuning_result_cache.htm
upvoted 2 times
Rakeshpro
2 years, 4 months ago
Answer is A & E
upvoted 2 times
...
...
...
...
...
sudhirdavim
4 years, 1 month ago
A and E
upvoted 2 times
...
CosminCof
4 years, 2 months ago
AE is the correct answer
upvoted 2 times
...
orakell
5 years, 2 months ago
Why C and not E?
upvoted 1 times
orakell
5 years, 2 months ago
I think C is incorrect since this reference says the "DETERMISTIC" clause cache isn't shared across sessions. https://www.red-gate.com/simple-talk/sql/oracle/result-cache-part-1/
upvoted 1 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago