• Home
  • Blog
  • About
  • Archive
  • Wish List
  • ATOM 0.3
  • RSS 2.0
  •  

    How to see Business Event Parameters

    Business Event mechanism provided by Oracle Workflow is a very good tool for customization and to add new business functionality on a particular event. (Mostly asynchronous)

    But while coding a subscription function, having event name is not sufficient. Sometimes you will require more parameters to handle the event in a proper way.

    For example, you want to use delete or update event of a record and in such cases sometimes it is not possible to fetch older data based on event name or primary key. Using event parameters, code, which raised the event, can pass older data, which may be useful for event subscription.

    Following basic code snippet shows, how we can check all the parameters passed with the event.

    procedure&nbsp;log_me&nbsp;(t&nbsp;varchar2)&nbsp;IS&nbsp;pragma&nbsp;autonomous_transaction;&nbsp;<br />begin&nbsp;<br />&nbsp;&nbsp;insert&nbsp;into&nbsp;my_log_table&nbsp;values(t);&nbsp;<br />&nbsp;&nbsp;commit;&nbsp;<br />
    end;<br /><br />function&nbsp;update_asgn&nbsp;(p_subscription_guid&nbsp;in&nbsp;raw,&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p_event&nbsp;in&nbsp;out&nbsp;WF_EVENT_T)&nbsp;return&nbsp;varchar2&nbsp;is<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;l_wf_parameter_list_t&nbsp;wf_parameter_list_t;<br />&nbsp;&nbsp;&nbsp;&nbsp;i&nbsp;number&nbsp;:=&nbsp;1;<br />&nbsp;&nbsp;&nbsp;&nbsp;c&nbsp;number;<br />&nbsp;&nbsp;&nbsp;&nbsp;l_key&nbsp;varchar2(30);<br />&nbsp;&nbsp;&nbsp;&nbsp;l_val&nbsp;varchar2(2000);<br />begin<br />&nbsp;&nbsp;l_wf_parameter_list_t&nbsp;:=&nbsp;p_event.getParameterList();<br />&nbsp;&nbsp;c&nbsp;:=&nbsp;l_wf_parameter_list_t.count();<br />&nbsp;&nbsp;<br />&nbsp;&nbsp;log_me('event&nbsp;=&nbsp;'&nbsp;||&nbsp;p_event.getEventName());<br />&nbsp;&nbsp;log_me('count&nbsp;:&nbsp;'&nbsp;||&nbsp;c);<br />&nbsp;&nbsp;<br />&nbsp;&nbsp;while&nbsp;(i&lt;=c)&nbsp;<br />&nbsp;&nbsp;loop<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;l_key&nbsp;:=&nbsp;l_wf_parameter_list_t(i).getName();<br />&nbsp;&nbsp;&nbsp;&nbsp;l_val&nbsp;:=&nbsp;l_wf_parameter_list_t(i).getValue();<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;log_me(l_key&nbsp;||&nbsp;'='&nbsp;||&nbsp;l_val);<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;i&nbsp;:=&nbsp;i&nbsp;+&nbsp;1;<br />&nbsp;&nbsp;end&nbsp;loop;<br />&nbsp;&nbsp;<br />&nbsp;&nbsp;return&nbsp;'SUCCESS';<br />&nbsp;&nbsp;exception<br />&nbsp;&nbsp;&nbsp;&nbsp;when&nbsp;others&nbsp;then&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;log_me('errm'&nbsp;||&nbsp;sqlerrm);<br />end;

    Here wf_parameter_list_t is a varray. For more information on API please refer Oracle Workflow API Reference

    Most important thing is, you can check same at WF_DEFERRED queue log from Oracle Application Manager -> Workflow Manger without writing any code! :)

    Njoy,
    Hardik Tank

    Leave a Reply

    Close
    E-mail It