Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
缺少右括号oracle sql_Sql_Oracle - Fatal编程技术网

缺少右括号oracle sql

缺少右括号oracle sql,sql,oracle,Sql,Oracle,我得到以下查询,它告诉我缺少右括号。没有第一个select和listagg的内部子查询工作得很好,但是当我添加 SELECT audit_date, charge_type, customer_no, nam, result, LISTAGG(charge_type, ',') WITHIN GROUP (ORDER BY charge_type desc) charge_name 它告诉我-缺少右括号,尽管我看不出有错误 查询: SELECT audit_date, cha

我得到以下查询,它告诉我缺少右括号。没有第一个select和listagg的内部子查询工作得很好,但是当我添加

   SELECT audit_date, charge_type, customer_no, nam, result, 
   LISTAGG(charge_type, ',') WITHIN GROUP (ORDER BY charge_type desc) charge_name
它告诉我-缺少右括号,尽管我看不出有错误

查询:

  SELECT audit_date, charge_type, customer_no, nam, result, 
  LISTAGG(charge_type, ',') WITHIN GROUP (ORDER BY charge_type desc) charge_name
 FROM
     (
      SELECT audit_date, charge_type, customer_no, name nam, sum(amount) result
      FROM
         ( 
          select 
           CASE 
            WHEN i.charge_type = 'GSMUsageCharge' THEN 'GSMUsageCharge'
            ELSE i.charge_type
            END charge_type,
           CASE 
            WHEN i.charge_type='GSMUsageCharge' AND cp.name='Service Charges' THEN 'Call Charges'
            ELSE cp.name
           END name,
       i.amount amount, s.audit_date, cu.customer_no, g.mobile_no
      from charge.gp_schedule gp, charge.gsm_charge_plan cp, ledger.sales_audit s,  
      ledger.invoice_item i, service.gsm g, service.contract c, 
      ccare.customer cu, charge.gsm_fixed_charge gfc
      where s.code = i.sales_audit_code
      and i.charge_plan_code = gp.charge_plan_code
      and gp.charge_plan_code = cp.code
      and cp.service_code = g.code
      and g.contract_code = c.contract_no
      and c.customer_code = cu.customer_no
      and gfc.code(+) = gp.charge_code
      and s.type_code = 'IR'
     ) modified_names
   group by audit_date, customer_no, charge_type, name;
 ) res
 GROUP BY audit_date, charge_type, customer_no, nam, result;

问题在于这一行:

group by audit_date, customer_no, charge_type, name;

分号结束查询字符串。只需删除它。

名称
后面还有一个分号,结束查询。