QuestionQ112

VerifiedAccessing an Oracle Database with Oracle Supplied Tools

You want to write a query that prompts for two column names and the WHERE condition each time it runs in a session, but prompts for the table name only the first time it runs.

The variables used in the query are never undefined in your session.

Which query can be used?

Explanation

In SQL*Plus, a single-ampersand substitution variable is discarded after substitution and prompts again when the statement is executed, whereas a double-ampersand variable is defined and retained for the session after its first prompt. Thus &col1, &col2, and &condition prompt on every execution, while &&table prompts only once. Oracle SQL*Plus documentation

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!