DBA Data[Home] [Help]

APPS.AMW_PROC_ORG_APPROVAL_PKG SQL Statements

The following lines contain the word 'select', 'insert', 'update' or 'delete':

Line: 15

  x_index_tbl.delete;
Line: 16

  x_t1.delete;
Line: 17

  x_t2.delete;
Line: 40

    update amw_process_organization
    set approval_status = 'PA'
    where process_id = p_process_id
    and organization_id = p_org_id
    and end_date is null;
Line: 56

    insert into amw_process_locks
    (organization_id,
    locking_process_id,
    locked_process_id,
    LAST_UPDATE_DATE,
    LAST_UPDATED_BY,
    LAST_UPDATE_LOGIN,
    CREATION_DATE,
    CREATED_BY,
    object_version_number
    )
    values
    (
    p_org_id,
    p_process_id,
    p_process_id,
    sysdate,
    G_USER_ID,
    G_LOGIN_ID,
    sysdate,
    G_USER_ID,
    1
    );
Line: 82

        insert into amw_process_locks
        (organization_id,
        locking_process_id,
        locked_process_id,
	LAST_UPDATE_DATE,
	LAST_UPDATED_BY,
	LAST_UPDATE_LOGIN,
	CREATION_DATE,
	CREATED_BY,
	object_version_number
	)
		(select distinct p_org_id, p_process_id, child_id, sysdate, G_USER_ID, G_LOGIN_ID, sysdate, G_USER_ID, 1
 				 from amw_latest_hierarchies
 				 start with parent_id = p_process_id and organization_id = p_org_id
 					connect by prior child_id = parent_id and organization_id = p_org_id   );
Line: 98

/*        (select p_org_id, p_process_id, parent_child_id, sysdate, G_USER_ID, G_LOGIN_ID, sysdate, G_USER_ID, 1
        from amw_org_hierarchy_denorm
        where process_id = p_process_id
        and up_down_ind = 'D'
        and organization_id = p_org_id
        and hierarchy_type = 'L');
Line: 107

        insert into amw_process_locks
        (organization_id,
        locking_process_id,
        locked_process_id,
	LAST_UPDATE_DATE,
	LAST_UPDATED_BY,
	LAST_UPDATE_LOGIN,
	CREATION_DATE,
	CREATED_BY,
	object_version_number
	)
        (select p_org_id, p_process_id, child_process_id, sysdate, G_USER_ID, G_LOGIN_ID, sysdate, G_USER_ID, 1
        from amw_latest_hierarchy_ORG_V
        where parent_process_id = p_process_id
        and child_organization_id = p_org_id);
Line: 127

        insert into amw_process_locks
        (organization_id,
        locking_process_id,
        locked_process_id,
	LAST_UPDATE_DATE,
	LAST_UPDATED_BY,
	LAST_UPDATE_LOGIN,
	CREATION_DATE,
	CREATED_BY,
	object_version_number
	)(select distinct p_org_id, p_process_id, child_id, sysdate, G_USER_ID, G_LOGIN_ID, sysdate, G_USER_ID, 1
 				 from amw_latest_hierarchies
 				 start with parent_id = p_process_id and organization_id = p_org_id
 					connect by prior child_id = parent_id and organization_id = p_org_id   );
Line: 142

/*       (select p_org_id, p_process_id, parent_child_id, sysdate, G_USER_ID, G_LOGIN_ID, sysdate, G_USER_ID, 1
        from amw_org_hierarchy_denorm
        where process_id = p_process_id
        and up_down_ind = 'D'
        and organization_id = p_org_id
        and hierarchy_type = 'L');
Line: 160

							p_update_count	in varchar2 := FND_API.G_TRUE) is

rev_num number;
Line: 167

 				select distinct child_id parent_child_id
 				from amw_latest_hierarchies
 				start with parent_id = p_process_id and organization_id = p_org_id
 				connect by prior child_id = parent_id and organization_id = p_org_id;
Line: 173

        select distinct child_id parent_child_id,parent_id
        from amw_latest_hierarchies
        start with parent_id = p_process_id and organization_id = (-1*p_org_id)
        connect by prior child_id = parent_id and organization_id = (-1*p_org_id);
Line: 180

/*        select parent_child_id
        from amw_org_hierarchy_denorm
        where process_id = p_process_id
        and up_down_ind = 'D'
        and organization_id = p_org_id
        and hierarchy_type = 'L';
Line: 195

    select approval_status
    into curr_app_status
    from amw_process_organization
    where process_id = p_process_id
    and organization_id = p_org_id
    and end_date is null;
Line: 210

    delete from amw_process_locks
    where organization_id = p_org_id
    and locking_process_id = p_process_id;
Line: 214

    update amw_process_organization
    set approval_status = 'A',
    approval_date = APPROV_TXN_DATE
    where process_id = p_process_id
    and organization_id = p_org_id
    and end_date is null
    returning revision_number into rev_num;
Line: 223

        update amw_process_organization
        set approval_end_date = APPROV_TXN_DATE
        where process_id = p_process_id
        and organization_id = p_org_id
        and revision_number = (rev_num-1);
Line: 234

    IF p_update_count = FND_API.G_TRUE THEN
	-- Now updat the Org Count......
	amw_rl_hierarchy_pkg.update_org_count(p_process_id);
Line: 251

                update amw_process_organization
                set approval_status = 'A',
                approval_date = APPROV_TXN_DATE
                where process_id = c2_rec.parent_child_id
                and organization_id = p_org_id
                and end_date is null
                returning revision_number into rev_num;
Line: 260

                    update amw_process_organization
                    set approval_end_date = APPROV_TXN_DATE
                    where process_id = c2_rec.parent_child_id
                    and organization_id = p_org_id
                    and revision_number = (rev_num-1);
Line: 269

                IF p_update_count = FND_API.G_TRUE THEN
                -- Update the Org Count
                amw_rl_hierarchy_pkg.update_org_count(c2_rec.parent_child_id);
Line: 274

               delete from amw_latest_hierarchies
               where child_id  = c2_rec.parent_child_id
               and parent_id = c2_rec.parent_id
               and organization_id = -p_org_id;
Line: 284

    IF p_update_count = FND_API.G_TRUE THEN
    amw_org_hierarchy_pkg.upd_appr_control_count(p_org_id, null); --ko, commenting this.. -2);
Line: 303

                update amw_process_organization
                set approval_status = 'A',
                approval_date = APPROV_TXN_DATE
                where process_id = c1_rec.parent_child_id
                and organization_id = p_org_id
                and end_date is null
                returning revision_number into rev_num;
Line: 312

                    update amw_process_organization
                    set approval_end_date = APPROV_TXN_DATE
                    where process_id = c1_rec.parent_child_id
                    and organization_id = p_org_id
                    and revision_number = (rev_num-1);
Line: 321

                IF p_update_count = FND_API.G_TRUE THEN
                -- Update the Org Count
                amw_rl_hierarchy_pkg.update_org_count(c1_rec.parent_child_id);
Line: 333

    amw_rl_hierarchy_pkg.update_approved_denorm(p_org_id);
Line: 335

    IF p_update_count = FND_API.G_TRUE THEN
    amw_org_hierarchy_pkg.upd_appr_control_count(p_org_id, null); --ko, commenting this.. -2);
Line: 348

    update amw_process_organization
    set approval_status = 'D'
    where process_id = p_process_id
    and organization_id = p_org_id
    and end_date is null;
Line: 354

    delete from amw_process_locks
    where organization_id = p_org_id
    and locking_process_id = p_process_id;
Line: 371

        select 1 --parent_child_id, a.approval_status
        into l_dummy
        from amw_process_organization  a
        where a.organization_id = p_org_id
        and a.end_date is null
        and a.approval_status <> 'A'
        and a.process_id in ( select alh.child_id
                              from amw_latest_hierarchies alh
                              start with alh.parent_id = p_process_id and alh.organization_id = p_org_id
                              connect by prior alh.child_id = alh.parent_id and alh.organization_id = p_org_id);
Line: 383

        select 1 --parent_child_id, a.approval_status
        into l_dummy
        from amw_org_hierarchy_denorm d, amw_process_organization a
        where d.process_id = p_process_id
        and d.organization_id = p_org_id
        and up_down_ind = 'D'
        and hierarchy_type = 'L'
        and a.process_id = d.parent_child_id
        and a.organization_id = p_org_id
        and a.end_date is null
        and a.approval_status <> 'A';
Line: 434

        select 1 --parent_child_id, a.approval_status
        into l_dummy
        from amw_process_organization  a
        where a.organization_id = p_org_id
        and a.end_date is null
        and a.approval_status <> 'A'
        and a.process_id in ( select alh.child_id
                              from amw_latest_hierarchies alh
                              start with alh.parent_id = p_process_id and alh.organization_id = p_org_id
                              connect by prior alh.child_id = alh.parent_id and alh.organization_id = p_org_id);
Line: 446

        select 1 --parent_child_id, a.approval_status
        into l_dummy
        from amw_org_hierarchy_denorm d, amw_process_organization a
        where d.process_id = p_process_id
        and d.organization_id = p_org_id
        and up_down_ind = 'D'
        and hierarchy_type = 'L'
        and a.process_id = d.parent_child_id
        and a.organization_id = p_org_id
        and a.end_date is null
        and a.approval_status <> 'A';
Line: 482

    update amw_risk_associations
    set approval_date = APPROV_TXN_DATE
    where pk2 = p_process_id
    and pk1 = p_org_id
    and object_type = 'PROCESS_ORG'
    and approval_date is null;
Line: 489

    update amw_risk_associations
    set deletion_approval_date = APPROV_TXN_DATE
    where pk2 = p_process_id
    and pk1 = p_org_id
    and object_type = 'PROCESS_ORG'
    and deletion_date is not null
    and deletion_approval_date is null;
Line: 497

    update amw_control_associations
    set approval_date = APPROV_TXN_DATE
    where pk2 = p_process_id
    and pk1 = p_org_id
    and object_type = 'RISK_ORG'
    and approval_date is null;
Line: 504

    update amw_control_associations
    set deletion_approval_date = APPROV_TXN_DATE
    where pk2 = p_process_id
    and pk1 = p_org_id
    and object_type = 'RISK_ORG'
    and deletion_date is not null
    and deletion_approval_date is null;
Line: 512

    update amw_acct_associations
    set approval_date = APPROV_TXN_DATE
    where pk2 = p_process_id
    and pk1 = p_org_id
    and object_type = 'PROCESS_ORG'
    and approval_date is null;
Line: 519

    update amw_acct_associations
    set deletion_approval_date = APPROV_TXN_DATE
    where pk2 = p_process_id
    and pk1 = p_org_id
    and object_type = 'PROCESS_ORG'
    and deletion_date is not null
    and deletion_approval_date is null;
Line: 527

    update amw_objective_associations
    set approval_date = APPROV_TXN_DATE
    where pk1 = p_org_id
    and pk2 = p_process_id
    and object_type in ( 'PROCESS_ORG' , 'CONTROL_ORG')
    and approval_date is null;
Line: 534

    update amw_objective_associations
    set deletion_approval_date = APPROV_TXN_DATE
    where pk1 = p_org_id
    and pk2 = p_process_id
    and object_type in ( 'PROCESS_ORG' , 'CONTROL_ORG')
    and deletion_date is not null
    and deletion_approval_date is null;
Line: 543

    update amw_ap_associations
    set association_creation_date = sysdate
    where pk1 = p_org_id
    and   pk2 = p_process_id
    and   object_type = 'CTRL_ORG'
    and   association_creation_date is null;
Line: 550

    update AMW_AP_ASSOCIATIONS
    set deletion_date = sysdate
    WHERE object_type = 'CTRL_ORG'
    and pk1 = p_org_id
    and pk2 = p_process_id
    and association_creation_date is not null
    and pk3 not in ( SELECT control_id from
                 amw_control_associations
                 where object_type = 'RISK_ORG'
                 AND PK1 = p_org_id
                 AND PK2 = p_process_id
                 AND approval_date is not null
                 and deletion_approval_date is null);
Line: 564

/*    update amw_objective_associations
    set approval_date = APPROV_TXN_DATE
    where pk1 = p_process_id
    and object_type = 'PROCESS_ORG'
    and approval_date is null;
Line: 570

    update amw_objective_associations
    set deletion_approval_date = APPROV_TXN_DATE
    where pk1 = p_process_id
    and object_type = 'PROCESS_ORG'
    and deletion_date is not null
    and deletion_approval_date is null;
Line: 577

    update amw_significant_elements
    set approval_date = APPROV_TXN_DATE
    where pk1 = p_process_id
    and object_type = 'PROCESS_ORG'
    and approval_date is null;
Line: 583

    update amw_significant_elements
    set deletion_approval_date = APPROV_TXN_DATE
    where pk1 = p_process_id
    and object_type = 'PROCESS_ORG'
    and deletion_date is not null
    and deletion_approval_date is null;  */
Line: 606

              (select parent_process_id, child_process_id, child_order_number
              from (select * from amw_latest_hierarchy_ORG_V where child_organization_id = p_org_id and parent_approval_status = 'A' and child_approval_status = 'A')
              start with parent_process_id = -2
              connect by prior child_process_id = parent_process_id)
			 MINUS
			 (select parent_process_id, child_process_id, child_order_number
             from AMW_CURR_APP_HIERARCHY_ORG_V
             where child_organization_id = p_org_id);
Line: 619

			 (select parent_process_id, child_process_id from AMW_CURR_APP_HIERARCHY_ORG_V
			  where parent_process_id = p_process_id
              and child_organization_id = p_org_id)
			 MINUS
			 (select parent_process_id, child_process_id from amw_latest_hierarchy_ORG_V
			  where parent_process_id = p_process_id
              and child_organization_id = p_org_id);
Line: 632

			  (select parent_process_id, child_process_id from AMW_CURR_APP_HIERARCHY_ORG_V
              where parent_process_id is not null
              and child_organization_id = p_org_id)
			  MINUS
			  (select parent_process_id, child_process_id from
                (select * from AMW_CURR_APP_HIERARCHY_ORG_V where child_organization_id = p_org_id)
			   start with parent_process_id = -2
			   connect by prior child_process_id = parent_process_id);
Line: 650

    				insert into amw_approved_hierarchies
                    (organization_id,
                    parent_id,
                    child_id,
                    start_date,
                    child_order_number,
		    LAST_UPDATE_DATE,
		    LAST_UPDATED_BY,
		    LAST_UPDATE_LOGIN,
		    CREATION_DATE,
		    CREATED_BY,
		    object_version_number )
                    values
                    (p_org_id,
                    a_link.parent_process_id,
                    a_link.child_process_id,
                    APPROV_TXN_DATE,
                    a_link.child_order_number,
		    sysdate,
		    G_USER_ID,
		    G_LOGIN_ID,
		    sysdate,
		    G_USER_ID,
		    1
		    );
Line: 681

				insert into amw_approved_hierarchies
                    (organization_id,
                    parent_id,
                    child_id,
                    start_date,
                    child_order_number,
		    		LAST_UPDATE_DATE,
		    		LAST_UPDATED_BY,
		    		LAST_UPDATE_LOGIN,
		    		CREATION_DATE,
		   			CREATED_BY,
		    		object_version_number )
                    values
                    (p_org_id,
                    x_parent_tbl(i),
                    x_child_tbl(i),
                    APPROV_TXN_DATE,
                    x_child_ord_tbl(i),
		    		sysdate,
		    		G_USER_ID,
		    		G_LOGIN_ID,
		    		sysdate,
		    		G_USER_ID,
		    		1
		    		);
Line: 717

        			update amw_approved_hierarchies
                    set end_date = APPROV_TXN_DATE,
			object_version_number = object_version_number + 1
                    where organization_id = p_org_id
                    and parent_id = defunct_link.parent_process_id
                    and child_id = defunct_link.child_process_id
                    and end_date is null;
Line: 730

        			update amw_approved_hierarchies
                    set end_date = APPROV_TXN_DATE,
			object_version_number = object_version_number + 1
                    where organization_id = p_org_id
                    and parent_id = defunct_link.parent_process_id
                    and child_id = defunct_link.child_process_id
                    and end_date is null;
Line: 741

					update amw_approved_hierarchies
                    set end_date = APPROV_TXN_DATE,
						object_version_number = object_version_number + 1
                    where organization_id = p_org_id
                    and parent_id = x_parent_tbl(i)
                    and child_id = x_child_tbl(i)
                    and end_date is null;
Line: 763

			  select distinct alh.child_id parent_child_id
        from amw_latest_hierarchies alh
        start with alh.child_id = p_process_id and alh.organization_id = p_org_id
        connect by prior alh.child_id = alh.parent_id and alh.organization_id = p_org_id;
Line: 769

        select parent_child_id
        from amw_org_hierarchy_denorm
        where process_id = pid
        and up_down_ind = 'D'
        and hierarchy_type = 'L'
        and organization_id = p_org_id
        union
        select pid from dual;
Line: 780

    select risk_id from amw_risk_associations where pk2 = pid and pk1 = poid and object_type = 'PROCESS_ORG';
Line: 783

    select control_id from amw_control_associations where pk2 = pid and pk1 = poid and object_type = 'RISK_ORG';
Line: 800

                        select 1
                        into l_dummy
                        from amw_risks_b
                        where risk_id = ass_risks_rec.risk_id
                        and approval_status = 'A';
Line: 819

                        select 1
                        into l_dummy
                        from amw_controls_b
                        where control_id = ass_controls_rec.control_id
                        and approval_status = 'A';
Line: 839

                        select 1
                        into l_dummy
                        from amw_risks_b
                        where risk_id = ass_risks_rec.risk_id
                        and approval_status = 'A';
Line: 858

                        select 1
                        into l_dummy
                        from amw_controls_b
                        where control_id = ass_controls_rec.control_id
                        and approval_status = 'A';
Line: 1038

CURSOR deleted_exceptions(org_id NUMBER, process_id NUMBER) IS
SELECT exception_object_id,
       old_pk1,
			 old_pk2,
			 old_pk3,
			 old_pk4,
			 old_pk5,
			 old_pk6,
			 object_type
FROM amw_exceptions_b
WHERE approved_flag = 'N'
AND old_PK1 = org_Id
AND old_PK2 = process_id
AND transaction_type = 'DEL'
AND object_type IN ('PROCESS', 'RISK', 'CTRL')
AND end_date IS NULL;
Line: 1056

SELECT exception_object_id,
			 new_pk1,
			 new_pk2,
			 new_pk3,
			 new_pk4,
			 new_pk5,
			 new_pk6,
			 object_type
FROM amw_exceptions_b
WHERE approved_flag = 'N'
AND new_pk1 = org_Id
AND new_pk2 = process_id
AND transaction_type = 'ADD'
AND object_type IN ('PROCESS', 'RISK', 'CTRL')
AND end_date IS NULL;
Line: 1075

SELECT exception_object_id
FROM amw_exceptions_b
WHERE  NVL(new_pk1, -99) = NVL(p_pk1, -99)
AND    NVL(new_pk2, -99) = NVL(p_pk2, -99)
AND    NVL(new_pk3, -99) = NVL(p_pk3, -99)
AND    NVL(new_pk4, -99) = NVL(p_pk4, -99)
AND    NVL(new_pk5, -99) = NVL(p_pk5, -99)
AND    NVL(new_pk6, -99) = NVL(p_pk6, -99)
AND object_type = p_obj_type
AND transaction_type = 'ADD'
AND end_date IS NULL;
Line: 1090

SELECT exception_object_id
FROM amw_exceptions_b
WHERE  NVL(old_pk1, -99) = NVL(p_pk1, -99)
AND    NVL(old_pk2, -99) = NVL(p_pk2, -99)
AND    NVL(old_pk3, -99) = NVL(p_pk3, -99)
AND    NVL(old_pk4, -99) = NVL(p_pk4, -99)
AND    NVL(old_pk5, -99) = NVL(p_pk5, -99)
AND    NVL(old_pk6, -99) = NVL(p_pk6, -99)
AND object_type = p_obj_type
AND transaction_type = 'DEL'
AND end_date IS NULL;
Line: 1103

deleted_exceptions_rec deleted_exceptions%ROWTYPE;
Line: 1125

			 UPDATE amw_exceptions_b SET end_date = SYSDATE	where exception_object_id = past_appr_del_ex_rec.exception_object_id;
Line: 1128

	  	 UPDATE amw_exceptions_b SET end_date = SYSDATE, approved_flag = 'Y'	where exception_object_id = added_exceptions_rec.exception_object_id;
Line: 1132

	-- Similarly Check For the Delete Exceptions .... End Date if any previous exceptions exists..
	for deleted_exceptions_rec in  deleted_exceptions(p_org_id, p_process_id) LOOP
  	EXIT WHEN  deleted_exceptions%NOTFOUND;
Line: 1137

  	   deleted_exceptions_rec.OLD_PK1,
			 deleted_exceptions_rec.OLD_PK2,
			 deleted_exceptions_rec.OLD_PK3,
			 deleted_exceptions_rec.OLD_PK4,
			 deleted_exceptions_rec.OLD_PK5,
			 deleted_exceptions_rec.OLD_PK6,
			 deleted_exceptions_rec.OBJECT_TYPE) LOOP
			 EXIT WHEN past_appr_addd_ex%NOTFOUND;
Line: 1147

			 UPDATE amw_exceptions_b SET end_date = SYSDATE	where exception_object_id = past_appr_addd_ex_rec.exception_object_id;
Line: 1150

	  	 UPDATE amw_exceptions_b SET end_date = SYSDATE, approved_flag = 'Y'	where exception_object_id = deleted_exceptions_rec.exception_object_id;
Line: 1156

  UPDATE amw_exceptions_b
  SET approved_flag = 'Y'
  WHERE  end_date is null
  AND (     (old_pk1 = p_org_id AND 	old_pk2 = p_process_id AND transaction_type = 'DEL')
  			  OR (new_pk1 = p_org_id AND new_pk2 = p_process_id AND transaction_type = 'ADD') )
  AND object_type IN ('PROCESS' , 'RISK' , 'CTRL');
Line: 1219

  select ah.parent_id , ah.child_id, AH.CHILD_ORDER_NUMBER
    from amw_latest_hierarchies ah
    where ah.parent_id =(select pp.process_id
                          from amw_process_organization pp
                          where pp.organization_id = ah.organization_id
                          and  pp.process_id = ah.parent_id
                          and pp.end_date is null
                          and pp.APPROVAL_STATUS ='A')
     and ah.child_id = ( select Cp.process_id
                          from amw_process_organization Cp
                          where Cp.organization_id = ah.organization_id
                          and  Cp.process_id = ah.child_id
                          and Cp.end_date is null
                          and Cp.APPROVAL_STATUS ='A')
     and ah.organization_id = l_org_id;
Line: 1236

	select ah.parent_id , ah.child_id
    from amw_approved_hierarchies ah
    where ah.parent_id =(select pp.process_id
                          from amw_process_organization pp
                          where pp.organization_id = ah.organization_id
                          and  pp.process_id = ah.parent_id
                          and pp.approval_date is not null
                          and pp.approval_end_date is null
                          and pp.deletion_date is null)
     and ah.child_id = ( select Cp.process_id
                          from amw_process_organization Cp
                          where Cp.organization_id = ah.organization_id
                          and  Cp.process_id = ah.child_id
                          and Cp.approval_date is not null
                          and Cp.approval_end_date is null
                          and Cp.deletion_date is null)
     and ah.start_date is not null
     and ah.end_date is null
     and ah.organization_id = l_org_id;
Line: 1321

	select ah.parent_id , ah.child_id
    from amw_approved_hierarchies ah
    where ah.parent_id =(select pp.process_id
                          from amw_process_organization pp
                          where pp.organization_id = ah.organization_id
                          and  pp.process_id = ah.parent_id
                          and pp.approval_date is not null
                          and pp.approval_end_date is null
                          and pp.deletion_date is null)
     and ah.child_id = ( select Cp.process_id
                          from amw_process_organization Cp
                          where Cp.organization_id = ah.organization_id
                          and  Cp.process_id = ah.child_id
                          and Cp.approval_date is not null
                          and Cp.approval_end_date is null
                          and Cp.deletion_date is null)
     and ah.start_date is not null
     and ah.end_date is null
     and ah.organization_id = l_org_id;