编译报错 CREATE OR REPLACE PROCEDURE get_dev_cs IS sql_tem VARCHAR2(4000); v_dt NUMBER; BEGIN ----om_subscriber_yyyymm sql_tem := 'truncate table ycyd.Subscriber_cs'; EXECUTE IMMEDIATE sql_tem; FOR v_dt IN (SELECT to_number(substr(table_name, '15')) db FROM sys.all_tables a WHERE a.owner = upper('jour1') AND a.table_name LIKE upper('om_subscriber_202___') AND substr(table_name, '15') > 202205) LOOP -- 循环往b里添加数据 sql_tem := ' INSERT INTO ycyd.Subscriber_cs SELECT a.order_id, a.done_date, a.cust_id, a.subscriber_ins_id, a.access_num FROM jour1.om_subscriber_' || v_dt.db || ' a WHERE a.action = 0 AND a.is_usim = 1'; -- 执行sql EXECUTE IMMEDIATE sql_tem; END LOOP; ----om_order_yyyymm sql_tem := 'truncate table ycyd.order_cs'; EXECUTE IMMEDIATE sql_tem; COMMIT; FOR v_dt IN (SELECT to_number(substr(table_name, '15')) db FROM sys.all_tables a WHERE a.owner = upper('jour1') AND a.table_name LIKE upper('om_subscriber_202___') AND substr(table_name, '15') > 202205) LOOP -- 循环往b里添加数据 sql_tem := ' INSERT INTO ycyd.order_cs SELECT order_id, dev_id FROM JOUR1.om_order_' || v_dt.db || ' b'; -- 执行sql EXECUTE IMMEDIATE sql_tem; END LOOP; COMMIT; ---dev sql_tem := 'truncate table ycyd.yd_order_dev_3056'; EXECUTE IMMEDIATE sql_tem; -- 添加数据 sql_tem := ' INSERT INTO ycyd.yd_order_dev_3056 SELECT a.order_id, a.done_date, a.cust_id, a.subscriber_ins_id, a.access_num, c.dev_id, c.dev_name, d.code, c.dev_busi_code, c.corp_org, c.company_name, c.department_code, c.department_name, c.remarks FROM ycyd.Subscriber_cs a LEFT JOIN ycyd.order_cs b ON a.order_id = b.order_id LEFT JOIN params1.sec_developer c ON b.dev_id = c.dev_id LEFT JOIN (SELECT DISTINCT oo.code,s.bill_id FROM params1.sec_operator oo, params1.sec_staff s WHERE s.staff_id = oo.staff_id AND oo.state = 1 AND oo.staff_id NOT in ('123402933','123395474','123404209')) d ON c.dev_phone = d.bill_id WHERE c.corp_org = 3056'; -- 执行sql EXECUTE IMMEDIATE sql_tem; COMMIT; END get_dev_cs;
时间: 2024-04-14 21:27:11 浏览: 157
根据你提供的存储过程代码,我注意到在最后一个LEFT JOIN子句中使用了NOT IN来排除特定的staff_id。然而,你在NOT IN子句中使用了字符串而不是逗号分隔的值列表。这可能导致编译错误。
为了解决这个问题,你可以将NOT IN子句修改为使用逗号分隔的值列表。例如:
```sql
LEFT JOIN (
SELECT DISTINCT oo.code, s.bill_id
FROM params1.sec_operator oo, params1.sec_staff s
WHERE s.staff_id = oo.staff_id
AND oo.state = 1
AND oo.staff_id NOT IN (123402933, 123395474, 123404209)
) d ON c.dev_phone = d.bill_id
```
请注意,我将NOT IN子句中的值从字符串转换为了数值,并且没有使用引号。
如果你仍然遇到编译错误,请提供完整的错误消息,以便我能够更准确地帮助你解决问题。
阅读全文