DECLARE
  l_test_load BOOLEAN := upper('&&1') = 'TEST';
  l_fat_load  BOOLEAN := upper('&&1') = 'FAT';
  l_uat_load  BOOLEAN := upper('&&1') = 'UAT';
  l_live_load  BOOLEAN := upper('&&1') = 'LIVE';
  l_train_load  BOOLEAN := upper('&&1') = 'TRAIN';
  l_dev_load  BOOLEAN := upper(nvl('&&1','DEV')) = 'DEV';

BEGIN

  IF l_test_load THEN
    mip_bulk_load.g_flow_id := 102;
  ELSIF l_fat_load THEN
    mip_bulk_load.g_flow_id := 200;
  ELSIF l_dev_load THEN
    mip_bulk_load.g_flow_id := 155;
  ELSIF l_uat_load THEN
    mip_bulk_load.g_flow_id := 400;
  ELSIF l_train_load THEN
    mip_bulk_load.g_flow_id := 800;
  END IF;

  IF mip_bulk_load.g_flow_id IS NOT NULL THEN
    mip_bulk_load.init;   
    mip_bulk_load.load_all;
    mip_bulk_load.report_err;
  ELSE
    dbms_output.put_line('Run bulk_load: Unexpected parameter value of &&1 received');
  END IF;

  update system_configuration
     set value = 'WEBMIP ('||upper('&&1')||'-'||to_char(sysdate,'DD-MON-YYYY HH24:MI')||')'
   where parameter = 'SYSTEM_NAME';

END;
/
exit
/
