Hi,
I have a insert query in the procedure with execute immediate and it is taking time. Due to this my procedure is taking time. Please help me on this. My sample code as below.
procedure test(p_qp_req_id VARCHAR2,
p_parent_qp_req_id VARCHAR2,
p_avail_check VARCHAR2,
p_threshold NUMBER,
p_poolid VARCHAR2,
p_continueavail VARCHAR2,
p_rescount OUT NUMBER,
p_ret_code OUT VARCHAR2,
p_ret_msg OUT VARCHAR2)
begin
v_poolsql:= 'insert into pc_eri_erimatch_matchres_gtt(qp_req_id,corpid,personid,pool_id,positionid,workschedulerule) '||
' select distinct '|| P_QP_REQ_ID||' P_QP_REQ_ID ,res.corpid, res.personid,rmap.pool_id,res.positionid ,res.workschedulerule '||
' from pc_eri_erimatch_res_info res ,pr_eri_data_pool_res_mapping rmap '||
q'[ where res.resourcestatus='Active' and res.personid=rmap.personid(+) ]';
if p_poolid is not null
then
v_poolsql:=v_poolsql || ' and rmap.pool_id in ('''||p_poolid||''' )' ;
end if;
EXECUTE IMMEDIATE v_poolsql;
end test;