[Home] [Help]
525: is
526: --l_sysdate DATE := sysdate;
527: cursor c_top_level_rl is
528: (select distinct parent_id
529: from amw_latest_hierarchies
530: where (organization_id is null or organization_id = -1)
531: )
532: minus
533: (select distinct child_id parent_id
530: where (organization_id is null or organization_id = -1)
531: )
532: minus
533: (select distinct child_id parent_id
534: from amw_latest_hierarchies
535: where (organization_id is null or organization_id = -1)
536: );
537:
538: cursor c_top_level_org(l_org_id in number) is
536: );
537:
538: cursor c_top_level_org(l_org_id in number) is
539: (select distinct parent_id
540: from amw_latest_hierarchies
541: where (organization_id = l_org_id)
542: )
543: minus
544: (select distinct child_id parent_id
541: where (organization_id = l_org_id)
542: )
543: minus
544: (select distinct child_id parent_id
545: from amw_latest_hierarchies
546: where (organization_id = l_org_id)
547: );
548:
549:
1135: l_dummy pls_integer;
1136:
1137: l_approval_status amw_process.approval_status%type;
1138:
1139: l_child_order_number amw_latest_hierarchies.child_order_number%type;
1140:
1141: CURSOR c1 is
1142: (select parent_process_id,
1143: child_process_id,
1215:
1216:
1217:
1218: --update the latest hierarchy table
1219: insert into amw_latest_hierarchies(ORGANIZATION_ID,
1220: PARENT_ID,
1221: CHILD_ID,
1222: CHILD_ORDER_NUMBER,
1223: LAST_UPDATE_DATE,
1454:
1455: /* update the latest hierarchy table
1456: * first we update the denorm table
1457: */
1458: delete from amw_latest_hierarchies
1459:
1460: where
1461: parent_id = p_parent_process_id and
1462: child_id = p_child_process_id and
1981: -- If it was present we do not do anything
1982: -- In particular we DO NOT UPDATE the child_order_number ..
1983: -- even though p_overwrite_ex may be 'Y'
1984: begin
1985: select 1 into l_dummy from amw_latest_hierarchies
1986: where parent_id = p_parent_process_id
1987: and child_id = l_process_id
1988: and (organization_id is null or organization_id = -1);
1989: exception
1988: and (organization_id is null or organization_id = -1);
1989: exception
1990: when no_data_found
1991: then
1992: insert into amw_latest_hierarchies (ORGANIZATION_ID,
1993: PARENT_ID,
1994: CHILD_ID,
1995: CHILD_ORDER_NUMBER,
1996: LAST_UPDATE_DATE,
2075:
2076:
2077:
2078: begin
2079: select 1 into l_dummy from amw_latest_hierarchies
2080: where parent_id = p_parent_process_id
2081: and child_id = l_process_id
2082: and (organization_id is null or organization_id = -1);
2083: exception
2081: and child_id = l_process_id
2082: and (organization_id is null or organization_id = -1);
2083: exception
2084: when no_data_found then
2085: insert into amw_latest_hierarchies (ORGANIZATION_ID,
2086: PARENT_ID,
2087: CHILD_ID,
2088: CHILD_ORDER_NUMBER,
2089: LAST_UPDATE_DATE,
2153: cur_child_id := get_process_id_from_wf_params
2154: (icm_diff_wf(ctr).child_name,
2155: icm_diff_wf(ctr).child_item_type);
2156:
2157: delete from amw_latest_hierarchies
2158: where (organization_id is null or organization_id = -1)
2159: and parent_id = l_process_id
2160: and child_id = cur_child_id;
2161: end loop;
2246: l_process_id := create_new_icm_process(p_name,p_item_type,p_display_name,
2247: p_description);
2248:
2249:
2250: insert into amw_latest_hierarchies (organization_id,
2251: parent_id,
2252: child_id,
2253: child_order_number,
2254: LAST_UPDATE_DATE,
2480: p_init_msg_list varchar2(10) := FND_API.G_FALSE;
2481: l_dummy pls_integer;
2482: L_CHILD_ORDER NUMBER;
2483: l_approval_status amw_process.approval_status%type;
2484: l_child_order_number amw_latest_hierarchies.child_order_number%type;
2485:
2486: CURSOR c1 is
2487: (select parent_process_id,
2488: child_process_id,
2572: ELSE
2573: L_CHILD_ORDER := P_CHILD_ORDER_NUMBER;
2574: END IF;
2575:
2576: insert into amw_latest_hierarchies(ORGANIZATION_ID,
2577: PARENT_ID,
2578: CHILD_ID,
2579: CHILD_ORDER_NUMBER,
2580: LAST_UPDATE_DATE,
3606: else
3607: select 1 into ret_val
3608: from dual
3609: where (exists
3610: (select parent_id from amw_latest_hierarchies
3611: where parent_id = p_process_id
3612: and (organization_id = -1 or organization_id is null)))
3613: or (exists
3614: (select child_id from amw_latest_hierarchies
3610: (select parent_id from amw_latest_hierarchies
3611: where parent_id = p_process_id
3612: and (organization_id = -1 or organization_id is null)))
3613: or (exists
3614: (select child_id from amw_latest_hierarchies
3615: where child_id = p_process_id
3616: and (organization_id = -1 or organization_id is null)));
3617:
3618: return ret_val;
3643: and (organization_id is null or organization_id = -1)
3644: and (end_date is null or end_date > sysdate)
3645: and child_id not in
3646: (select child_id
3647: from amw_latest_hierarchies
3648: where parent_id = p_process_id
3649: and (organization_id is null or organization_id = -1));
3650: exception
3651: when no_data_found then
3651: when no_data_found then
3652: begin
3653: select child_id
3654: into l_dummy
3655: from amw_latest_hierarchies
3656: where parent_id = p_process_id
3657: and (organization_id is null or organization_id = -1)
3658: and child_id not in
3659: (select child_id
3780: l_risk_exists boolean :=false;
3781: l_control_exists boolean :=false;
3782: cursor parents(pid number) is
3783: select parent_id
3784: from amw_latest_hierarchies
3785: where child_id = pid
3786: and (organization_id is null or organization_id = -1);
3787: parent_rec parents%rowtype;
3788: l_flag varchar2(10);
3875:
3876: for parent_rec in parents(p_process_id) loop
3877: exit when parents%notfound;
3878: revise_process_if_necessary(parent_rec.parent_id);
3879: delete from amw_latest_hierarchies
3880: where parent_id = parent_rec.parent_id
3881: and child_id = p_process_id
3882: and (organization_id is null or organization_id = -1);
3883: end loop;
3882: and (organization_id is null or organization_id = -1);
3883: end loop;
3884:
3885: --kosriniv need to de link the children this process has..
3886: delete from amw_latest_hierarchies
3887: where parent_id = p_process_id
3888: and (organization_id is null or organization_id = -1);
3889: delete from amw_process where process_id = p_process_id;
3890: delete from amw_process_names_tl where process_rev_id = previd;
4137: diff := LENGTH(l_child_string);
4138: end if;
4139: select SUBSTR(l_child_string, 1, diff) into childstr from dual;
4140: l_child_id := to_number(childstr);
4141: delete from amw_latest_hierarchies where parent_id = p_parent_process_id
4142: and child_id = l_child_id and organization_id = -1;
4143: select LTRIM(str, 'x') into l_child_string from dual;
4144: end loop;
4145: exception
4175: is
4176: l_api_name constant varchar2(30) := 'add_activities';
4177: l_dummy pls_integer;
4178: l_approval_status amw_process.approval_status%type;
4179: l_child_order_number amw_latest_hierarchies.child_order_number%type;
4180: p_init_msg_list varchar2(10) := FND_API.G_TRUE;
4181: str varchar2(4000);
4182: diff number;
4183: childstr varchar2(100);
4234: close c_link_exist;
4235:
4236:
4237: --update the latest hierarchy table
4238: insert into amw_latest_hierarchies(ORGANIZATION_ID,
4239: PARENT_ID,
4240: CHILD_ID,
4241: CHILD_ORDER_NUMBER,
4242: LAST_UPDATE_DATE,