Как "ослабить" связи между документами? |
|
|
Написал Administrator
|
05.07.2005 |
"Ослабить" связи между документами можно используя процедуру:
procedure SMART_LINK ( nDOCUMENT in number, sUNITCODE in varchar2 ) as begin for rec_in in ( select RN from DOCINPT where DOCUMENT = nDOCUMENT and UNITCODE = sUNITCODE and STATUS = 0 ) loop update DOCINPT set STATUS = 1 where RN = rec_in.RN; end loop; for rec_out in ( select RN from DOCOUTPT where DOCUMENT = nDOCUMENT and UNITCODE = sUNITCODE and STATUS = 0 ) loop update DOCOUTPT set STATUS = 1 where RN = rec_out.RN; end loop; end SMART_LINK;
А вернуть обратно процедурой:
procedure HARD_LINK ( nDOCUMENT in number, sUNITCODE in varchar2 ) as begin for rec_in in ( select RN from DOCINPT where DOCUMENT = nDOCUMENT and UNITCODE = sUNITCODE and STATUS = 1 ) loop update DOCINPT set STATUS = 0 where RN = rec_in.RN; end loop; for rec_out in ( select RN from DOCOUTPT where DOCUMENT = nDOCUMENT and UNITCODE = sUNITCODE and STATUS = 1 ) loop update DOCOUTPT set STATUS = 0 where RN = rec_out.RN; end loop; end HARD_LINK;
Источник: форум Корпорации "Парус"
|