Predict the output of the following statement. Select substr(“Yellow is A colour”,1,5) from dual;
Answer options
A
Yellow
B
Yel
C
Yello
D
elow
Correct answer: Yello
Explanation
In Oracle SQL, SUBSTR(string, start_position, length) uses 1-based indexing. SUBSTR('Yellow is A colour', 1, 5) starts at position 1 ('Y') and takes 5 characters, returning 'Yello'. 'Yellow' would require length 6; 'Yel' requires length 3; 'elow' would start at position 2.