create or replace view v_batch_running as 
 SELECT subquery.batch_no,
    subquery.process_stage_id,
    subquery.master_product_id,
    subquery.batch_start,
    concat((subquery.hours)::text, ' hrs', ' : ', lpad((subquery.minutes)::text, 2, '0'::text), ' mins') AS duration_formatted
   FROM ( SELECT batch_details.batch_no,
            batch_details.process_stage_id,
            batch_details.master_product_id,
            batch_details.batch_start,
            ((date_part('day'::text, (now() - batch_details.batch_start)) * (24)::double precision) + date_part('hour'::text, (now() - batch_details.batch_start))) AS hours,
            date_part('minute'::text, (now() - batch_details.batch_start)) AS minutes
           FROM batch_details
          WHERE ((batch_details.batch_start IS NOT NULL) AND (batch_details.batch_end IS NULL))) subquery;