The following examples show EXECUTE IMMEDIATE statements in ESQL/C. Both examples use host variables that contain a CREATE DATABASE statement. The first example uses the SQL statement terminator ( ; ) inside the quoted string.
sprintf(cdb_text1, "create database %s;", usr_db_id); EXEC SQL execute immediate :cdb_text; sprintf(cdb_text2, "create database %s", usr_db_id); EXEC SQL execute immediate :cdb_text;