解决绑定变量问题:未使用绑定变量的语句如下:sprintf(sqlstr, \"insert into scott.test1 (num1, num2) values (%d,%d)\",n_var1, n_var2); EXEC SQL EXECUTE IMMEDIATE :sqlstr ; EXEC SQL COMMIT; 使用绑定变量的语句如下:strcpy(sqlstr, \"insert into test (num1, num2) values (:v1, :v2)\"); EXEC SQL PREPARE sql_stmt FROM :sqlstr; EXEC SQL EXECUTE sql_stmt USING :n_var1, :n_var2; EXEC SQL COMMIT;