下面是我的出错代码:
dynamic_sql := 'select t3.departmentcode, t3.total from (select departmentcode,count(*) total from ' || str_tablename || ' where (LASTUPDATEDTIME between to_date(to_char(sysdate-1,"yyyy-mm-dd") ,''yyyy-mm-dd'') and to_date(to_char(sysdate,"yyyy-mm-dd") ,''yyyy-mm-dd'')) and departmentcode is not NULL group by departmentcode) t3,v_s_data_input_dept_usernum t4 where t3.departmentcode = ' || str_departmentcode || '';
更正后,执行成功的代码:
dynamic_sql := 'select t3.departmentcode, t3.total from (select departmentcode,count(*) total from ' || str_tablename || ' where (LASTUPDATEDTIME between to_date(''' || to_char(sysdate-1,'yyyy-mm-dd') || ''',''yyyy-mm-dd'') and to_date(''' || to_char(sysdate,'yyyy-mm-dd') || ''',''yyyy-mm-dd'')) and departmentcode is not NULL group by departmentcode) t3,v_s_data_input_dept_usernum t4 where t3.departmentcode = ' || str_departmentcode || '';
红色的部分对比
希望对出现类似错误的有所帮助
还有第二种情况