Updated on 2024-06-03 GMT+08:00

Overview

Passing data between a C program and SQL statements is particularly simple in embedded SQL. Instead of having the program paste data into the statements, you can simply write the name of a C variable into the SQL statement, prefixed by a colon. The following is an example.
EXEC SQL INSERT INTO sometable VALUES (:v1, 'foo', :v2);

This statement references two C variables named v1 and v2 and uses a regular SQL string, indicating that you are not restricted to use one kind of data or the other.