Multiple choice technology databases

Which of the following statement is used for executing dynamic SQL

  1. EXEC SQL

  2. EXECUTE IMMEDIATE

  3. DECLARE CURSOR

  4. OPEN

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

EXECUTE IMMEDIATE is used to prepare and execute a dynamic SQL statement in a single step. It's ideal for statements that won't be repeatedly executed. EXEC SQL is for static SQL embedded in host programs, while DECLARE CURSOR and OPEN are for cursor operations.