Skip to main content

Hello

How to execute Schedule Database Task in custom event.

Thanks.

Hi @tariq 

You can use below structure in an online SQL type action.

Please note that this a example and please update the variables accordingly and refer to Deferred_Call method to understand all the parameters.

DECLARE
attr1_ VARCHAR2(32000);

BEGIN

Client_SYS.Clear_Attr(attr1_);
Client_SYS.Add_To_Attr('ORDER_NO','&NEW:ORDER_NO',attr1_);
Client_SYS.Add_To_Attr('NEW_REASON','&NEW:BLOCKED_REASON',attr1_);
Client_SYS.Add_To_Attr('OLD_REASON','&OLD:BLOCKED_REASON',attr1_);
Transaction_SYS.Deferred_Call('TEST_API.Update_customer_order',attr1_,description_);
END; 


 


Here’s another method. Put the PL/SQL block you want to run inside the single quotes section for stmt_, where I have select ''Test'' from dual. anything you put inside this section with single quotes needs to be converted to double quotes.

 

DECLARE
    attr_         VARCHAR2(32000);
    sql_msg_      VARCHAR2(32000);
    stmt_         VARCHAR2(32000);
    job_id_       NUMBER;
    error_text_   VARCHAR2(2000);       
BEGIN
stmt_ := '

select ''Test'' from dual

';
sql_msg_ := Message_SYS.Construct('UPD');
   Message_SYS.Add_Attribute(sql_msg_, 'SQL', stmt_);
   Client_SYS.Clear_Attr(attr_);
   Client_SYS.Add_To_Attr('SQL_DATA_', sql_msg_, attr_);
   Client_SYS.Add_To_Attr('MSG_', '', attr_);
   Transaction_SYS.Deferred_Call(job_id_,'Fnd_Event_Action_API.Action_Executeonlinesql','PARAMETER',attr_,'Background Job Name');
END;


Reply