Question
The SQL statement
SELECT SUBSTR('123456789', INSTR('abcabcabc', 'b'), 4) FROM DUAL;
SELECT SUBSTR('123456789', INSTR('abcabcabc', 'b'), 4) FROM DUAL;
Answer: Option B
Answer: B. 2345
Explanation: The INSTR() function is used to find the first occurrence of a substring in a string. The syntax for INSTR() is INSTR(string, substring). In this question, the INSTR() function is used to find the first occurrence of the substring 'b' in the string 'abcabcabc'. The INSTR() function returns the position of the first occurrence of the substring, which is 2.
The SUBSTR() function is used to extract a substring from a given string. The syntax for SUBSTR() is SUBSTR(string, start_position, [length]). In this question, the SUBSTR() function is used to extract a substring from the string '123456789' starting at the position 2 and with a length of 4. Therefore, the output of the query is '2345'.
Was this answer helpful ?
Answer: B. 2345
Explanation: The INSTR() function is used to find the first occurrence of a substring in a string. The syntax for INSTR() is INSTR(string, substring). In this question, the INSTR() function is used to find the first occurrence of the substring 'b' in the string 'abcabcabc'. The INSTR() function returns the position of the first occurrence of the substring, which is 2.
The SUBSTR() function is used to extract a substring from a given string. The syntax for SUBSTR() is SUBSTR(string, start_position, [length]). In this question, the SUBSTR() function is used to extract a substring from the string '123456789' starting at the position 2 and with a length of 4. Therefore, the output of the query is '2345'.
Was this answer helpful ?
More Questions on This Topic :
Question 8. Find all the cities whose humidity is 89....
Question 9. What is the meaning of LIKE '%0%0%'....
Submit Solution