Oracle Database Administration I — Question 77
You want to write a query that prompts for two column names and the WHERE condition each time it is executed in a session but only prompts for the table name the first time it is executed.
The variables used in your query are never undefined in your session.
Which query can be used?
Answer options
- A. SELECT &&col1, &&col2 FROM &table WHERE &&condition = &&cond
- B. SELECT &col1, &col2 FROM &&table WHERE &condition
- C. SELECT &col1, &col2 FROM ג€&tableג€ WHERE &condition
- D. SELECT '&&col1', '&&col2' FROM &table WHERE '&&condition' = '&cond';
- E. SELECT &&col1, &&col2 FROM &table WHERE &&condition
Correct answer: B
Explanation
Option B is correct because it uses the correct syntax for prompting for column names and ensures the table name is only prompted the first time. The other options either incorrectly use prompt syntax or structure the query in a way that does not meet the requirement of asking for the table name only once.