Which of the query will print the output as 'TCS' (single quotes should come in the output)
-
select ' ' ' || 'TCS' || ' ' ' from dual
-
select ' ' 'TCS' ' ' from dual
-
select 'TCS' from dual
-
select "TCS" from dual
In Oracle SQL, to include a single quote in a string literal, you escape it by doubling it. The string ' ' 'TCS' ' ' actually parses as: quote-space-quote (space), then 'TCS', then quote-space-quote (space). The doubled quotes represent literal single quote characters. Option B correctly uses this escaping.
In Oracle you escape a single quote inside a string literal by doubling it. SELECT '''TCS''' FROM dual parses as: open quote, '' (one literal '), TCS, '' (one literal '), close quote — producing the output 'TCS'. Option B is this query, so it is correct; option A adds broken concatenation and options C/D omit the quotes.