SELECT DECODE (2,2 , DECODE (3,3,2)) FROM DUAL ;
Pick one of the choices
O
it is illegal
O it prints garbage,
O it prints 3
it prints 2
Clear selection
Answers
SELECT DECODE (2,2,DECODE (3,3,2)) FROM DUAL;
This query 'Prints 2 (Option D)'.
Explanation:
The equivalent query of the Oracle SELECT DECODE (2,2,DECODE (3,3,2)) FROM DUAL; in SQL server is SELECT DECODE (2,2,DECODE (3,3,2)).
The function DECODE() acts as a conditional statement here.
As the inner part executes first, from SELECT DECODE (2,2,DECODE (3,3,2)), DECODE(3,3,2) will be executed first.
DECODE(a,b,c) -> if a==b: return c.
So, DECODE(3,3,2) returns 2; /*as 3==3 is true.*/
Now, substituting the return value in the main query, the query becomes DECODE(2,2,2)
And DECODE(2,2,2) returns 2, and the selection statement prints 2
/*as 2==2 is true*/
Therefore, SELECT DECODE (2,2,DECODE (3,3,2)) FROM DUAL ; prints 2.
Learn more:
1. Below is the list of various types of application softwares: A. Database B. Desktop publishing...
brainly.in/question/21118142
2. The unattended interactive information systems such as automatic trailer machine and ATM is called
brainly.in/question/21899388