语句:Insertintovideosource(select*fromvideosourcesparewhereVideoSourceIDnotin(selectVid... 语句:Insert into videosource(select * from videosourcespare where VideoSourceID not in(select VideoSourceID from videosource))
补充:我在Oracle里面运行没有错误,但是在程序里面运行就报:ORA-00933: SQL 命令未正确结束 错误,怎么回事啊?
修改以后也不正确~ 增加了空格 分号 等等 还是不行啊 只能在数据库里运行 程序里还是报错 由于是个保密项目,源码不方便给出太多:
CString strSQL="Insert into videosource (select * from videosourcespare where videosourcespare.VideoSourceID not in (select VideoSourceID from videosource))";
if (!m_rs->Open(strSQL))//根据设备后备表将设备表中没有的数据插入
{
CString strtxt;
strtxt.Format("数据库操作错误,%s,语句:%s",m_rs->GetLastErrorString(),strSQL);
ErrorLog(strtxt);
return;
}

一、对于这个错误:

  1. 首先仔细检查 sql语句 是否存在语法错误。

(如果确认没有错误,可以拿到sql development中去用sql工具试试)。

2.检查使用连接数据库的方法。

executeQuery、execute、executeUpdate是否存在使用错误,或者换个试试。

3.我把sql语句中的‘;‘去掉了,然后sql语句运行正常,没有报错,原因未知。

二、解决方案:

1)方案一:清空 回收站 (recyclebin)命令 : PURGE recyclebin;

2)方案二:收回表的命令:命令 :flashback table 原表名 to before drop;

3)方案三:直接删除表,不经过回收站:

(1)方法一: drop table 表名 purge;

(2) 方法二 :停用数据库的回收战功能; 10.1版本中,修改隐藏参数 _recyclebinalter system set "_recyclebin" = false;10.2版本中,alter system set recyclebin = off。