exam questions

Exam 1z0-148 All Questions

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

Exam 1z0-148 topic 1 question 28 discussion

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

Examine this code:

Users of this function may set different date formats in their sessions.
Which two modifications must be made to allow the use of your sessions date format when outputting the cached result of this function?

  • A. Change the RETURN type to DATE.
  • B. Change AUTHID to CURRENT_USER.
  • C. Use the TO_CHAR function around SYSDATE, that is, 1_date := TO_CHAR (SYSDATE).
  • D. Change the data type of 1_date to DATE.
  • E. Set NLS_DATE_FORMAT to ‘DD-MM-YY’ at the instance level.
  • F. Set the RESULT_CACHE_MODE parameter to FORCE.
Show Suggested Answer Hide Answer
Suggested Answer: DF 🗳️

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
Rakeshpro
2 years, 4 months ago
CREATE OR REPLACE FUNCTION OT.invoice_date RETURN VARCHAR2 --RETURN DATE --Fix-1 RESULT_CACHE AUTHID definer IS l_date VARCHAR2(50); BEGIN --l_date := to_char(sysdate); --Fix-2 l_date := sysdate; RETURN l_date; END; /
upvoted 1 times
Rakeshpro
2 years, 4 months ago
Answer is A & D
upvoted 1 times
...
...
chrishillinger
2 years, 5 months ago
Selected Answer: AD
AD are the only viable options here
upvoted 1 times
...
sudhirdavim
4 years, 1 month ago
A and D are correct answer.
upvoted 2 times
...
CosminCof
4 years, 4 months ago
PRAGMA AUTHID is put on the question just to trick you (AUTHID works with SQL engine to verifies privilleges of an SQL user) Result Cache is used to trick you (if yu use sysdate the result of the function will never be cached). The answer is A and D (change the return type of the function and data type of local variable so the result of the function will be presented in the defaulte date format of the specific user)
upvoted 2 times
...
peguynya
4 years, 6 months ago
A and D
upvoted 3 times
...
Adela_bg
4 years, 7 months ago
I think B and D
upvoted 1 times
...
szefco
4 years, 8 months ago
A and D
upvoted 3 times
...
vuis
4 years, 11 months ago
A and D
upvoted 4 times
...
yurijk
5 years ago
didn't analyze this weird code, but A, C works as expected create or replace function invoice_date return date result_cache authid definer is l_date varchar2(50); begin l_date := to_char(SYSDATE); return l_date; end;
upvoted 4 times
...
orakell
5 years, 2 months ago
CE. result_cache_mode = force only makes sense for queries, not functions.
upvoted 1 times
...
Tinamoran
5 years, 3 months ago
c and d are the right answer
upvoted 1 times
orakell
5 years, 2 months ago
C and D don't make sense together. C assigns a varchar2 to l_date and D changes the type of of l_date to DATE. Won't compile like that.
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