Вопрос

I'm trying to execute 2 queries (SELECT AND UPDATE). Select works, but update doesn't make any changes. What am I doing wrong?

Here some code:

  OCI_Statement* st;
  OCI_Resultset* rs;
  query[0] ='\0';
  //cn is connection
  st = OCI_StatementCreate(cn);
  sprintf (query, "SELECT ..");
  printf (query);
  OCI_ExecuteStmt(st, query);
  rs = OCI_GetResultset(st);
  //this works
  while (OCI_FetchNext(rs)){


  }
  query[0] ='\0';
  //query is correct; it does updates in the console
  sprintf(query, "update vqc set vqc_u = 'J' where vqc_id >= 1 and vqc_id <= 12" );
  //fails
  //neither 
  OCI_ExecuteStmt(st, query);
  //nor
  OCI_Prepare(st, query);
  OCI_Execute(st);

  printf (query);
Это было полезно?

Решение

Are you using the same statement object ? if so, it cannot work. Do you use OCI_Commit() ? If not, nothing will be committed !

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top