Which SQL statement is used in embedded SQL to fetch data into host variables?
2024
Which SQL statement is used in embedded SQL to fetch data into host variables?
- A.
INSERT INTO
- B.
UPDATE
- C.
DELETE
- D.
SELECT INTO
- E.
Question not attempted
Attempted by 798 students.
Show answer & explanation
Correct answer: D
In embedded SQL, the SELECT INTO statement is used to fetch data from a database and store it directly into host variables. This allows the application to retrieve specific data from a table and use it in the host program. The syntax is: SELECT column1, column2 INTO :host_var1, :host_var2 FROM table_name WHERE condition; The INTO clause specifies the host variables where the retrieved data will be stored. This is essential for retrieving data in a structured way within a host language like C or COBOL.