Error: ORA-00911 invalid character

Error: ORA-00911 invalid character

在 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;

我收到以下错误:

cx_Oracle.DatabaseError: ORA-00911: invalid character

已经尝试过其他问题的解决方案:删除最后一个分号。

知道如何解决吗?

猜测是这个导致了问题:

where cust_id = c.cust_id and task_status = 'C'));commit;

您在一个查询中有两个 SQL 语句。删除 ;commit;。您的插入语句现在应该可以工作了。更改您的 python 并在 运行 插入后添加此内容:

connection.commit()

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