CREATE OR REPLACE PROCEDURE "P_UPD_BUDGET_BL" (p_hauptprojekt VARCHAR2, p_teilprojekt VARCHAR2, p_user VARCHAR2) AS
BEGIN

-- Stand (Datum) in dt861 setzen
update dt861 set
 di041669 = -- BL
  (select di008706 from dt823 where di034525 = 1 and di008413 = dt861.di023119),
 di041670 = -- SR
  (select max(di008706) from dt823 where di029179 = 1 and di008413 = dt861.di023119)
where
di023119 IN (Select di001001 from dt461 where di001052 = p_hauptprojekt); 

COMMIT;
  
  --  EXCEPTION WHEN OTHERS THEN 
  --  NULL;
                                      
END p_upd_budget_bl;

