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.
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)
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;
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
...
...
Log in to ExamTopics
Sign in:
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.
Rakeshpro
2 years, 4 months agoRakeshpro
2 years, 4 months agochrishillinger
2 years, 5 months agosudhirdavim
4 years, 1 month agoCosminCof
4 years, 4 months agopeguynya
4 years, 6 months agoAdela_bg
4 years, 7 months agoszefco
4 years, 8 months agovuis
4 years, 11 months agoyurijk
5 years agoorakell
5 years, 2 months agoTinamoran
5 years, 3 months agoorakell
5 years, 2 months ago