SQL Plus Question:

How to use SQL to build SQL, what is this called and give an example?

SQL Plus Interview Question
SQL Plus Interview Question

Answer:

This is called dynamic SQL. An example would be:
set lines 90 pages 0 termout off feedback off verify off
spool drop_all.sql
select ?drop user ?||username||? cascade;? from dba_users
where username not in ("SYS?,?SYSTEM?);
spool off
Essentially you are looking to see that they know to include a command (in this case DROP USER...CASCADE;) and that you need to concatenate using the ?||? the values selected from the database.


Previous QuestionNext Question
Explain What is the maximum number of triggers, can apply to a single table?Explain What is the output of SIGN function?