Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE OR REPLACE FUNCTION public.ret_background_tr_post()
- RETURNS void
- LANGUAGE plpgsql
- SET search_path TO '$user', 'public'
- AS $function$ DECLARE
- /*************************************************************************
- * Contributor(s): AHMAD HADI NUGROHO
- ************************************************************************/
- -- Logistice
- v_ResultStr VARCHAR(4000):=''; --OBTG:VARCHAR2--
- v_Record_ID VARCHAR(32); --OBTG:VARCHAR2--
- v_User_ID VARCHAR(32);
- v_Client_ID VARCHAR(32) ; --OBTG:VARCHAR2--
- v_Org_ID VARCHAR(32); --OBTG:VARCHAR2--
- v_Count NUMERIC;
- v_AD_Pinstance_ID VARCHAR(32); --OBTG:VARCHAR2--
- -- Parameter
- --TYPE RECORD IS REFCURSOR;
- Cur_TransferRequest RECORD;
- Cur_Parameter RECORD;
- BEGIN
- BEGIN --BODY
- -- Get Parameters
- v_ResultStr:='ReadingParameters';
- FOR Cur_Parameter IN
- (SELECT i.Record_ID,
- i.AD_User_ID,
- p.ParameterName,
- p.P_String,
- p.P_Number,
- p.P_Date,
- p.AD_Org_ID,
- p.AD_Client_ID
- FROM AD_PInstance i
- LEFT JOIN AD_PInstance_Para p
- ON i.AD_PInstance_ID=p.AD_PInstance_ID
- WHERE i.AD_PInstance_ID=p_PInstance_ID
- ORDER BY p.SeqNo
- )
- LOOP
- v_Record_ID:= Cur_Parameter.Record_ID;
- v_User_ID:= Cur_Parameter.AD_User_ID;
- v_Org_ID:= Cur_Parameter.AD_Org_ID;
- END LOOP; -- Get Parameter
- -- RAISE NOTICE '%',' Record_ID=' || v_Record_ID ;
- FOR Cur_TransferRequest IN (select m.m_movement_id
- from m_movement m
- where m.em_oez_is_tranfer_request ='Y'
- and m.ad_client_id = '9FEF116B9BA24538AC481B809CC750FF'
- and m.em_oez_docstatus = 'DR'
- -- and m.ad_org_id = v_Org_ID
- order by documentno asc
- ) LOOP
- perform ret_transfer_request_post(p_pinstance_id, Cur_TransferRequest.m_movement_id);
- END LOOP;
- END; --BODY
- EXCEPTION
- WHEN OTHERS THEN
- RAISE NOTICE '%','Background process exception: ' || v_ResultStr;
- RAISE EXCEPTION '%', SQLERRM;
- -- RETURN;
- END ; $function$
- ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement