Multiple choice technology programming languages

Which of the following statements uses embedded dynamic SQL?

  1. SELECT col1 INTO :hv from table1

  2. EXECUTE IMMEDIATE SELECT col1 INTO :hv FROM table1

  3. DECLARE c1 CURSOR FOR s1

  4. IMMEDIATE SELECT col1 INTO :hv FROM table1

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

EXECUTE IMMEDIATE is the statement used to execute dynamic SQL statements that are constructed and executed at runtime. Option A uses static SQL with a host variable. Option C declares a cursor for a prepared statement. Option D has incorrect syntax.