/*ALIAS>prop_db*/

/*SQLStart>2506*/
ALTER TABLE ANECS ADD AN_AREA NUMERIC(15,3);
/*SQLStop*/

/*SQLStart>2507*/
create procedure SETANECSAREA
as
declare variable AREA numeric(15,3);
declare variable DOC_ID integer;
begin
  FOR
      SELECT doc.DOC_ID, doc.doc_area
      FROM DOCUMENTS doc      
      INTO :DOC_ID, :AREA
  DO
  BEGIN
    UPDATE anecs an set an.an_area = :area where an.an_id = :DOC_ID;
  END

  suspend;
end
/*SQLStop*/

/*ManyStart>2508*/
EXECUTE PROCEDURE SETANECSAREA;
update anecs set an_area = 0 where an_area is null;
/*ManyStop*/

/*SQLStart>2509*/
DROP PROCEDURE SETANECSAREA;
/*SQLStop*/

/*SQLStart>2510*/
update RDB$RELATION_FIELDS set
RDB$NULL_FLAG = 1
where (RDB$FIELD_NAME = 'AN_AREA') and
(RDB$RELATION_NAME = 'ANECS')
/*SQLStop*/


/*SQLStart>2511*/
update system_strings set sys_str = '6.7.198.1' where sys_id = 1401;  /*BackOffice*/
/*SQLStop*/
