create or replace function get_fun_opposites(years       nvarchar2,
                                             mouth       nvarchar2,
                                             orgids      nvarchar2,
                                             datesources number,
                                             mz_qu       nvarchar2,
                                             table_name  nvarchar2)
  return number is
  q        number(7);
  sSqlStr  nvarchar2(2000);
  f        number(7);
  sSqlStrs nvarchar2(2000);
  t        number(7);
  w        number(7);
BEGIN  sSqlStr := 'SELECT sum(' || mz_qu || ') FROM' || ' ' || table_name || '
       LEFT JOIN (SELECT DISTINCT ddt.month_code,
                               substr(ddt.month_medium_desc,0,2) as yue,
                               ddt.quarter_medium_desc,
                               ddt.half_medium_desc,
                               substr(ddt.year_medium_desc,0,4) as nian
                 FROM DW_DIM_TIME ddt) ddt
      ON
         --ddt.nian = substr(powm.day_code,0,4)--年
         ddt.nian =' || years || 'and ddt.yue=' || mouth ||
             'LEFT JOIN (SELECT DISTINCT bds.data_source_code, bds.data_source_funame
                 FROM B_DATA_SOURCE bds) bds
      ON bds.data_source_code = ' || datesources || '
    LEFT JOIN (SELECT bdv.origid,
                      bdv.orgid,
                      NVL(bda.orgname, ''其他'') as orgname,
                      bdv.data_source
                 FROM B_DEPARTMENT_V bdv
                 LEFT JOIN B_DEPARTMENT bd
                   ON bd.orgid = bdv.origid
                  AND bd.data_source = bdv.data_source
                 LEFT JOIN B_DEPARTMENT_AS bda
                   ON bda.orgid = bdv.orgid
                  AND bda.data_source = bdv.data_source) dep
      ON dep.data_source =' || datesources ||
             'AND dep.origid =' || orgids;  -- execute immediate sSqlStr into q  EXECUTE IMMEDIATE  
  sSqlStr  INTO q using mz_qu,table_name,years,mouth,datesources,orgids;  sSqlStrs := 'SELECT sum(' || mz_qu || ') FROM' || ' ' || table_name || '
       LEFT JOIN (SELECT DISTINCT ddt.month_code,
                               substr(ddt.month_medium_desc,0,2) as yue,
                               ddt.quarter_medium_desc,
                               ddt.half_medium_desc,
                               substr(ddt.year_medium_desc,0,4) as nian
                 FROM DW_DIM_TIME ddt) ddt
      ON
         --ddt.nian = substr(powm.day_code,0,4)--年
         ddt.nian =' || (years - 1) ||
             --and ddt.yue=substr(powm.day_code,5,6)--月
              'and ddt.yue=' || mouth || 'LEFT JOIN (SELECT DISTINCT bds.data_source_code, bds.data_source_funame
                 FROM B_DATA_SOURCE bds) bds
      ON bds.data_source_code = ' || datesources || '
    LEFT JOIN (SELECT bdv.origid,
                      bdv.orgid,
                      NVL(bda.orgname,''其他'') as orgname,
                      bdv.data_source
                 FROM B_DEPARTMENT_V bdv
                 LEFT JOIN B_DEPARTMENT bd
                   ON bd.orgid = bdv.origid
                  AND bd.data_source = bdv.data_source
                 LEFT JOIN B_DEPARTMENT_AS bda
                   ON bda.orgid = bdv.orgid
                  AND bda.data_source = bdv.data_source) dep
      ON dep.data_source =' || datesources ||
              'AND dep.origid =' || orgids;        EXECUTE IMMEDIATE 
         sSqlStrs
         INTO f using mz_qu,table_name,years,mouth,datesources,orgids;
        
  t := (q - f) / f;  return t;
end;
出现
EXECUTE IMMEDIATE  
  sSqlStr  INTO q using mz_qu,table_name,years,mouth,datesources,orgids;
表达式类型错误 !
请指导。