我正在使用C API从oracle数据库创建和删除表。代码片段是
OCIStmt *stmt;
rc = OCIHandleAlloc(ora_env, (dvoid **)&stmt, OCI_HTYPE_STMT, 0, 0);
char *query = "DROP TABLE idmap_id;";
rc = OCIStmtPrepare(stmt, errhp, (OraText*)query, strlen(query), OCI_NTV_SYNTAX, OCI_DEFAULT);
rc = OCIStmtExecute(svchp, stmt, errhp, 1, 0, NULL, NULL, OCI_DEFAULT);
当我运行此DROP TABLE查询时,我收到以下错误
OCIStmtExecute() ORA-00933: SQL command not properly ended
当我用这样的
替换CREATE TABLE的查询时char *query = "CREATE TABLE idmap_id (id varchar2(32 CHAR) NOT NULL, CONSTRAINT idmap_id_pk PRIMARY KEY (id));";
我收到错误
OCIStmtExecute() ORA-00922: missing or invalid option
有人可以帮助我吗?
答案 0 :(得分:0)
删除分号。
(我想Oracle预计会有另一个SQL语句。)