title: Execute PL/SQL script in C++ using OCCI oracle
body: <p>I want to run SQL script from a C++ program. my code goes like this:</p>
  
  <pre><code>int main()
  { 
  //.....
  sql_stmt = "Insert into t1 values ('qwerty');\nInsert into 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 TO sp_1;\n"
  "WHEN OTHERS THEN\n"
  "rollback_check_counter :=0;\n"
  "ROLLBACK TO sp_1;\n"
  "END;\n"
  "END IF;\n"
  "commit;\n"
  "END;";
  
  
  try 
  {
      Connection *conn = env-&gt;createConnection(user,passwd); //error prone
      Statement *stmt = conn-&gt;createStatement();
      stmt-&gt;setSQL(sql_stmt);
      row_count = stmt-&gt;execute(); //stmt-&gt;execute(sql_stmt);
  
      Connection::conn-&gt;terminateStatement(Statement *stmt);
      //con-&gt;terminateStatement(stmt);
      env-&gt;terminateConnection(conn);
      Environment::terminateEnvironment(env);
  }
  catch(SQLException&amp; ex)
  {}
  //.....
  return 0;
  }
  </code></pre>
  
  <p>Although when i run these insert statement only they fairly run well but when i forms a SQL Script structure they seems to fail. I want to do so because i want to implement rollback. What am i missing? Could anyone suggest any alternative to implement it.</p>