In the customers table, the CUST_CITY column contains the value ‘Paris’ for the
CUST_FIRST_NAME ‘Abigail’.
Evaluate the following query: 
What would be the outcome?
A.
Abigail PA
B.
Abigail Pa
C.
Abigail IS
D.
An error message
Explanation:
In the customers table, the CUST_CITY column contains the value ‘Paris’ for the
CUST_FIRST_NAME ‘Abigail’.
Evaluate the following query: 
What would be the outcome?
A.
Abigail PA
B.
Abigail Pa
C.
Abigail IS
D.
An error message
Explanation:
The catch this issue is to use UPPER together with INITCAP function, however INITCAP preceding UPPER.
select initcap(‘Abigail’||’ ‘||upper(substr(‘Paris’,-length(‘Paris’),2)))as result from dual
RESULT
==========
Abigail Pa
Read 1 rows
select initcap(‘Abigail’||’ ‘||upper(substr(‘Paris’,-length(‘Paris’),2)))as result from dual
RESULT
==========
Abigail Pa
Read 1 rows
The INITCAP() function creates the whole expression first letter capital although the UPPER() initially made Paris to PA.
So B is right
Why is option C) not the answer?
Since,its ‘-Length’, it should start from the end of the word ‘Paris’ and take the last 2 alphabets, i.e. ‘is’
-Length(‘Paris”) = -5 = 5th character from last.
(‘Paris’,-5,2) = P is the 5th character from last character and 2 char to be selected = Pa
Hi Guys,
I’m doing preparation for Oracle Database 12c: sql fundamentals, so i have need some dump copies for it. if you guys have any idea about Oracle Databse 12c: sql fundamentals then please send me at [email protected] ..
Thanks,
Amit