Execute PL/SQL script in C++ using OCCI oracle -


i want run sql script c++ program. code goes this:

int main() {  //..... sql_stmt = "insert t1 values ('qwerty');\ninsert t1 values ('dothar');"            "//and many more insert statements";  sql_stmt = "declare\nrollback_check_counter number;\n" "begin\n" "rollback_check_counter :=1;\n" "savepoint sp_1;\nif rollback_check_counter = 1 then\n" "begin\n"+sql_stmt+"exception\n" "when program_error then\n" "rollback_check_counter :=0;\n" "rollback sp_1;\n" "when others then\n" "rollback_check_counter :=0;\n" "rollback sp_1;\n" "end;\n" "end if;\n" "commit;\n" "end;";   try  {     connection *conn = env->createconnection(user,passwd); //error prone     statement *stmt = conn->createstatement();     stmt->setsql(sql_stmt);     row_count = stmt->execute(); //stmt->execute(sql_stmt);      connection::conn->terminatestatement(statement *stmt);     //con->terminatestatement(stmt);     env->terminateconnection(conn);     environment::terminateenvironment(env); } catch(sqlexception& ex) {} //..... return 0; } 

although when run these insert statement run when forms sql script structure seems fail. want because want implement rollback. missing? suggest alternative implement it.

there ; missing after both rollback sp_1


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -