854: ELSIF (x_return_status = G_RET_STS_ERROR) THEN
855: RAISE FND_API.G_EXC_ERROR ;
856: END IF;
857:
858: INSERT INTO OKC_ARTICLE_RELATNS_ALL
859: (
860: SOURCE_ARTICLE_ID,
861: TARGET_ARTICLE_ID,
862: ORG_ID,
877: sysdate,
878: l_user_id,
879: l_login_id,
880: sysdate
881: from OKC_ARTICLE_RELATNS_ALL ARL1
882: WHERE org_id = G_GLOBAL_ORG_ID
883: AND exists
884: (select 1 from okc_article_versions, okc_article_adoptions adp
885: where article_id = target_article_id
890: (select 1 from okc_article_versions
891: where article_version_id = p_article_version_id
892: and source_article_id = article_id)
893: AND NOT EXISTS
894: (select 1 from okc_article_relatns_all ARL2
895: where arl1.source_article_id = arl2.source_article_id
896: and arl1.target_article_id = arl2.target_article_id
897: and arl1.relationship_type = arl2.relationship_type
898: and arl2.org_id = p_current_org_id);
896: and arl1.target_article_id = arl2.target_article_id
897: and arl1.relationship_type = arl2.relationship_type
898: and arl2.org_id = p_current_org_id);
899:
900: INSERT INTO OKC_ARTICLE_RELATNS_ALL
901: (
902: SOURCE_ARTICLE_ID,
903: TARGET_ARTICLE_ID,
904: ORG_ID,
919: sysdate,
920: l_user_id,
921: l_login_id,
922: sysdate
923: from OKC_ARTICLE_RELATNS_ALL ARL1
924: WHERE org_id = G_GLOBAL_ORG_ID
925: AND exists
926: (select 1 from okc_article_versions, okc_article_adoptions adp
927: where article_id = source_article_id
932: (select 1 from okc_article_versions
933: where article_version_id = p_article_version_id
934: and target_article_id = article_id)
935: AND NOT EXISTS
936: (select 1 from okc_article_relatns_all ARL2
937: where arl1.source_article_id = arl2.source_article_id
938: and arl1.target_article_id = arl2.target_article_id
939: and arl1.relationship_type = arl2.relationship_type
940: and arl2.org_id = p_current_org_id);
1499: ELSIF (x_return_status = G_RET_STS_ERROR) THEN
1500: RAISE FND_API.G_EXC_ERROR ;
1501: END IF;
1502: --------------------------------------------
1503: DELETE FROM OKC_ARTICLE_RELATNS_ALL
1504: WHERE source_article_id = l_article_version_rec.article_id
1505: AND org_id = p_current_org_id
1506: AND NOT EXISTS
1507: (SELECT 1 FROM OKC_ARTICLE_ADOPTIONS ADP, OKC_ARTICLE_VERSIONS AV
1510: AND ADP.ADOPTION_TYPE = 'ADOPTED'
1511: AND global_article_version_id = article_version_id
1512: );
1513:
1514: DELETE FROM OKC_ARTICLE_RELATNS_ALL
1515: WHERE target_article_id = l_article_version_rec.article_id
1516: AND org_id = p_current_org_id
1517: AND NOT EXISTS
1518: (SELECT 1 FROM OKC_ARTICLE_ADOPTIONS ADP, OKC_ARTICLE_VERSIONS AV