我得到 200 个供应商名称作为存储过程的巨大值的输入参数。我尝试在 CLOB、VARCHAR2(32767) 中声明。但是当我尝试执行时它不接受。请任何人帮助我如何处理这个问题。
CREATE OR REPLACE PROCEDURE GMMT_PROC.or_rmce_RB_grid_sp (
p_plant_cd IN VARCHAR2,
p_region_cd IN VARCHAR2,
p_matrl_nbr IN OUT VARCHAR2,
p_supplier_nbr IN OUT VARCHAR2,
p_supplier_name IN OUT CLOB,
p_mrpcontrollercd IN OUT VARCHAR2,
p_currency IN VARCHAR2,
oresultset OUT sys_refcursor,
p_err_cd OUT NUMBER,
p_err_msg OUT VARCHAR2
)
IS
sqlquery varchar2(10000);
p1 varchar2(10);
p2 varchar2(20);
p3 varchar2(20);
p4 varchar2(20);
v_percent varchar2(10):='%';
V_FROM_CURRENCY VARCHAR2(5);
V_EX_RATE NUMBER;
v_matrl_nbr VARCHAR2(10000);
v_supplier_nbr VARCHAR2(10000);
v_supplier_name CLOB;
v_mrpcontrollercd VARCHAR2(10000);
BEGIN
p1:='matrl_nbr';
v_matrl_nbr:=p_matrl_nbr;
p2:='supplier_nbr';
v_supplier_nbr :=p_supplier_nbr;
p3:='supplier_name_txt';
v_supplier_name :=p_supplier_name;
p4:='mrp_controller_cd';
v_mrpcontrollercd:=p_mrpcontrollercd;
sqlquery:='select wk_nbr, nbr_working_days,'||p1||' as matrl_nbr ,'||p2||' as supplier_nbr,'||p3||' as supplier_name_txt,'||p4||' as mrp_controller_cd,sum(reqmnt_qty)reqmnt_qty , sum(proj_inven_qty)proj_inven_qty, sum(doh) doh,sum(proj_recpt_1) proj_recpt_1, sum(proj_recpt_2) proj_recpt_2, sum(proj_recpt_3) proj_recpt_3, sum(proj_recpt_4) proj_recpt_4,sum( proj_recpt_total_qty) proj_recpt_total_qty,sum(consumption_qty) consumption_qty, sum(consumption_var_qty) consumption_var_qty , sum(final_recpt_qty) final_recpt_qty,sum(recpt_var_qty) recpt_var_qty from GMMT_OWNER.OR_RMCE_GTT_PROJ_RECPT_T ';
sqlquery:=sqlquery||' where ('''||v_matrl_nbr||''' IS NULL) OR matrl_nbr IN (SELECT * FROM TABLE(GMMT_PROC.OR_in_list_RPT5_FN('''||v_matrl_nbr||'''))) OR matrl_nbr like '''|| v_matrl_nbr||v_percent||'''';
sqlquery:=sqlquery||' AND ('''||v_supplier_nbr||''' IS NULL) OR supplier_nbr IN (SELECT * FROM TABLE(GMMT_PROC.OR_in_list_RPT5_FN('''||v_supplier_nbr||'''))) OR supplier_nbr like '''|| v_supplier_nbr||v_percent||'''';
sqlquery:=sqlquery||' AND ('''||v_supplier_name||''' IS NULL) OR supplier_name_txt IN (SELECT * FROM TABLE(GMMT_PROC.OR_in_list_RPT5_FN('''||v_supplier_name||'''))) OR supplier_name_txt like '''|| v_supplier_name||v_percent||'''';
sqlquery:=sqlquery||' AND ('''||v_mrpcontrollercd||''' IS NULL) OR mrp_controller_cd IN (SELECT * FROM TABLE(GMMT_PROC.OR_in_list_RPT5_FN('''||v_mrpcontrollercd||'''))) OR mrp_controller_cd like '''|| v_mrpcontrollercd||v_percent||'''';
sqlquery:=sqlquery||' group by wk_nbr, nbr_working_days,'||p1||','||p2||','||p3||','||p4||' order by wk_nbr';
OPEN oresultset FOR sqlquery;
dbms_output.put_line(sqlquery);
END;