Please enable JavaScript to view this site.

Invantive Estate

It´s possible to request the running of a background process to Invantive Vision from your own program. Use a PL/SQL code like:

begin

 --

 -- Start a job with parameters.

 --

 -- Log on to Invantive.

 --

 bubs_session.set_session_info

 ( 'my_program_name'

 , 'start etl process'

 , 'system'

 , 'no query'

 , coalesce(sys_context('userenv', 'ip_address'), '?')

 , sys_context('userenv', 'host')

 , 'my_url'

 , '$Header: http://svn.invantive.com/repos/p104/trunk/help/nl/manual/Topics/voorbeeld-eigen-achtergrondproces.xml 19891 2012-10-09 13:23:03Z gle3 $' || to_char(sysdate, 'YYYYMMDDHH24MISS')

 );

 --

 -- Submit background job.

 --

 bubs#background_jobs.submit('BUBS_RUN_ETL', sysdate);

 --

 -- Fill parameters (optional).

 --

 bubs#background_jobs.set_parameter('p_etl_file', '../etl/example.kjb');

 bubs#background_jobs.set_parameter('p_log_level', 'BASIC');

 bubs#background_jobs.finish_parameter_entry;

 --

 -- Save to allow job to be picked up by schedulers.

 --

 commit;

 --

 -- Wait till job ends (optional).

 --

 -- Starting release b41, you can substitute this code by:

 --

 -- bubs#background_jobs.wait_for_finish_job

 --

 declare

   l_dummy pls_integer;

 begin

   while true

   loop

     select 1

     into   l_dummy

     from   bubs_background_jobs_v bjb

     where  1=1

     and    bjb.bjb_seq         = bubs#background_jobs.get_bjb_seq_last_submitted

     and    bjb.bjb_datum_einde is null

     ;

   end loop;

 exception

   when no_data_found

   then

     null; -- Job ended.

 end;

end;

You can also use one job to start other jobs. In that case you only need to use the code from ‘Submit background job’. Waiting for the completion of all initiated jobs can be done with:

bubs#background_jobs.wait_for_finish_all_child_jobs;