Python 错误:ORA-00911无效字符

Python 错误:ORA-00911无效字符,python,database,oracle,cx-oracle,ora-00911,Python,Database,Oracle,Cx Oracle,Ora 00911,尝试在python中的cx_Oracle上运行此查询时 Insert into orange.cp4_freeze_tasks ( SELECT distinct cust_id, 'C' FROM (SELECT f.cust_id, cust_site, debt_invoiced + debt_no_invoiced deuda, DECODE (d.manual_level, 0, cp_level, manual_level) nivel, (SELECT n

尝试在python中的cx_Oracle上运行此查询时

Insert into orange.cp4_freeze_tasks (
SELECT distinct cust_id, 'C' 
  FROM (SELECT f.cust_id, cust_site, debt_invoiced + debt_no_invoiced deuda,
     DECODE (d.manual_level, 0, cp_level, manual_level) nivel,
     (SELECT nvl(freeze_limit,9999999999)
        FROM orange.cp4_level_config
       WHERE site_id = cust_site
         AND cplevel =
                  DECODE (d.manual_level,0, cp_level,manual_level)) freeze_limit
   FROM orange.cp4_freezed_customers f, orange.cp4_debt_status d
  WHERE f.cust_id = d.cust_id) c
 WHERE deuda <= freeze_limit / 2 and not exists (Select 1 from orange.cp4_freeze_tasks 
where cust_id = c.cust_id and task_status = 'C'));commit;
已经尝试了其他问题的解决方案:删除最后一个分号


你知道怎么解决吗?

我猜是这个问题造成的:

where cust_id = c.cust_id and task_status = 'C'));commit;
在一个查询中有两条SQL语句。删除
;承诺。您的insert语句现在应该可以工作了。更改python并在运行insert后添加:

connection.commit()

显然,更改
连接
以适合您使用的实际变量名。

会猜测是这个原因导致了问题:

where cust_id = c.cust_id and task_status = 'C'));commit;
在一个查询中有两条SQL语句。删除
;承诺。您的insert语句现在应该可以工作了。更改python并在运行insert后添加:

connection.commit()

显然,更改
connection
以适合您使用的实际变量名。

在发布完整的堆栈跟踪后,请注意,除了sql语句中以commit结尾外,任何东西都会跳出来。能否从python中删除commit和commit,比如connection.commit();?否则,您将把语句包装在一个匿名pl/sql块中。在完成完整的堆栈跟踪后,pleaseNothing向我跳了出来,除了在sql语句中以commit结束。能否从python中删除commit和commit,比如connection.commit();?否则,您将把语句包装在一个匿名pl/sql块中。这就成功了!有一刻我认为它不起作用,但查询需要时间。非常感谢。成功了!有一刻我认为它不起作用,但查询需要时间。非常感谢。