DBA Data[Home] [Help]

APPS.AMW_RL_HIERARCHY_PKG SQL Statements

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

Line: 17

  x_index_tbl.delete;
Line: 18

  x_t1.delete;
Line: 19

  x_t2.delete;
Line: 30

     select 1 from amw_proc_hierarchy_denorm
     where process_id = l_ancestor_id and
           parent_child_id = l_descendant_id and
           hierarchy_type = 'L' and
           up_down_ind = 'D';
Line: 77

procedure update_denorm_add_child(p_parent_id number,
                                  p_child_id number,
                                  l_sysdate in Date default sysdate)

is

-- CURSOR TO SELECT ALL THE ANCESTORS OF THE GIVEN PROCESS.
   cursor c_ancestors(l_process_id number) is
     select parent_child_id
     from amw_proc_hierarchy_denorm
     where process_id = l_process_id and
           up_down_ind = 'U';
Line: 95

     select parent_child_id
     from amw_proc_hierarchy_denorm
     where process_id = l_process_id and
           up_down_ind = 'D';
Line: 107

     select 1 from amw_proc_hierarchy_denorm
     where process_id = l_ancestor_id and
           parent_child_id = l_descendant_id and
           up_down_ind = 'D';
Line: 128

  x_index_tbl.delete;
Line: 229

      insert into amw_proc_hierarchy_denorm (PROCESS_ID,
                                             PARENT_CHILD_ID,
                                             UP_DOWN_IND,
                                             LAST_UPDATE_DATE,
                                             LAST_UPDATED_BY,
                                             CREATION_DATE,
                                             CREATED_BY,
                                             LAST_UPDATE_LOGIN,
                                             OBJECT_VERSION_NUMBER,
                                             HIERARCHY_TYPE)
      values
                                             (x_process_tbl(i),
                                             x_parent_child_tbl(i),
                                             x_up_down_ind_tbl(i),
                                             l_sysdate,
                                             G_USER_ID,
                                             l_sysdate,
                                             G_USER_ID,
                                             G_LOGIN_ID,
                                             1,
                                             'L');
Line: 257

end update_denorm_add_child;
Line: 387

procedure update_approved_denorm(p_org_id in number,
                                 l_sysdate in Date default sysdate)
is

cursor c_all_approved_links_rl is
       select parent_id, child_id
       from amw_approved_hierarchies
       where (organization_id is null or organization_id = -1)
       and (end_date is null or end_date > l_sysdate);
Line: 398

       select parent_id, child_id
       from amw_approved_hierarchies
       where (organization_id = l_org_id) and
       (end_date is null or end_date > l_sysdate);
Line: 448

      delete from amw_proc_hierarchy_denorm where hierarchy_type='A';
Line: 453

      delete from amw_org_hierarchy_denorm
      where organization_id = p_org_id and
      hierarchy_type='A';
Line: 466

        insert into amw_proc_hierarchy_denorm (PROCESS_ID,
                                               PARENT_CHILD_ID,
                                               UP_DOWN_IND,
                                               LAST_UPDATE_DATE,
                                               LAST_UPDATED_BY,
                                               CREATION_DATE,
                                               CREATED_BY,
                                               LAST_UPDATE_LOGIN,
                                               OBJECT_VERSION_NUMBER,
                                               HIERARCHY_TYPE)
       values
                                               (x_process_tbl(i),
                                                x_parent_child_tbl(i),
                                                x_up_down_ind_tbl(i),
                                                l_sysdate,
                                                G_USER_ID,
                                                l_sysdate,
                                                G_USER_ID,
                                                G_LOGIN_ID,
                                                1,
                                                'A');
Line: 489

        insert into amw_org_hierarchy_denorm (ORGANIZATION_ID,
                                               PROCESS_ID,
                                               PARENT_CHILD_ID,
                                               UP_DOWN_IND,
                                               LAST_UPDATE_DATE,
                                               LAST_UPDATED_BY,
                                               CREATION_DATE,
                                               CREATED_BY,
                                               LAST_UPDATE_LOGIN,
                                               OBJECT_VERSION_NUMBER,
                                               HIERARCHY_TYPE)
        values
                                               (p_org_id,
                                                x_process_tbl(i),
                                                x_parent_child_tbl(i),
                                                x_up_down_ind_tbl(i),
                                                l_sysdate,
                                                G_USER_ID,
                                                l_sysdate,
                                                G_USER_ID,
                                                G_LOGIN_ID,
                                                1,
                                                'A');
Line: 520

end update_approved_denorm;
Line: 522

procedure update_denorm(p_org_id in number,
                        l_sysdate in Date default sysdate)

is
--l_sysdate DATE := sysdate;
Line: 528

  (select distinct parent_id
   from amw_latest_hierarchies
   where (organization_id is null or organization_id = -1)
  )
  minus
  (select distinct child_id parent_id
   from amw_latest_hierarchies
   where (organization_id is null or organization_id = -1)
  );
Line: 539

  (select distinct parent_id
   from amw_latest_hierarchies
   where (organization_id = l_org_id)
  )
  minus
  (select distinct child_id parent_id
   from amw_latest_hierarchies
   where (organization_id = l_org_id)
  );
Line: 637

    delete from amw_proc_hierarchy_denorm where hierarchy_type='L';
Line: 639

    delete from amw_org_hierarchy_denorm
    where organization_id = p_org_id and
    hierarchy_type='L';
Line: 652

        insert into amw_proc_hierarchy_denorm (PROCESS_ID,
                                               PARENT_CHILD_ID,
                                               UP_DOWN_IND,
                                               LAST_UPDATE_DATE,
                                               LAST_UPDATED_BY,
                                               CREATION_DATE,
                                               CREATED_BY,
                                               LAST_UPDATE_LOGIN,
                                               OBJECT_VERSION_NUMBER,
                                               HIERARCHY_TYPE)
       values
                                               (x_process_tbl(i),
                                                x_parent_child_tbl(i),
                                                x_up_down_ind_tbl(i),
                                                l_sysdate,
                                                G_USER_ID,
                                                l_sysdate,
                                                G_USER_ID,
                                                G_LOGIN_ID,
                                                1,
                                                'L');
Line: 675

        insert into amw_org_hierarchy_denorm (ORGANIZATION_ID,
                                               PROCESS_ID,
                                               PARENT_CHILD_ID,
                                               UP_DOWN_IND,
                                               LAST_UPDATE_DATE,
                                               LAST_UPDATED_BY,
                                               CREATION_DATE,
                                               CREATED_BY,
                                               LAST_UPDATE_LOGIN,
                                               OBJECT_VERSION_NUMBER,
                                               HIERARCHY_TYPE)
        values
                                               (p_org_id,
                                                x_process_tbl(i),
                                                x_parent_child_tbl(i),
                                                x_up_down_ind_tbl(i),
                                                l_sysdate,
                                                G_USER_ID,
                                                l_sysdate,
                                                G_USER_ID,
                                                G_LOGIN_ID,
                                                1,
                                                'L');
Line: 705

end update_denorm;
Line: 753

  l_program_update_date amw_process.program_update_date%type;
Line: 776

    select process_id, process_rev_id, item_type, name, process_code,
           revision_number, approval_status, control_count,
           risk_count, org_count, significant_process_flag,
           standard_process_flag, certification_status,
           process_category, process_owner_id, finance_owner_id,
           application_owner_id, standard_variation,
           object_version_number, deletion_date,
           process_type, control_activity_type,
           attribute_category, attribute1,
           attribute2, attribute3, attribute4,
           attribute5, attribute6, attribute7,
           attribute8, attribute9, attribute10,
           attribute11, attribute12, attribute13,
           attribute14, attribute15, created_from,
           program_id, program_application_id,
           request_id, program_update_date, risk_count_latest,
           control_count_latest, classification

    into   l_process_id, l_process_rev_id, l_item_type, l_name, l_process_code,
           l_revision_number, l_approval_status, l_control_count,
           l_risk_count, l_org_count, l_significant_process_flag,
           l_standard_process_flag, l_certification_status,
           l_process_category, l_process_owner_id, l_finance_owner_id,
           l_application_owner_id, l_standard_variation,
           l_object_version_number, l_deletion_date,
           l_process_type, l_control_activity_type,
           l_attribute_category, l_attribute1,
           l_attribute2, l_attribute3, l_attribute4,
           l_attribute5, l_attribute6, l_attribute7,
           l_attribute8, l_attribute9, l_attribute10,
           l_attribute11, l_attribute12, l_attribute13,
           l_attribute14, l_attribute15, l_created_from,
           l_program_id, l_program_application_id,
           l_request_id, l_program_update_date,
           l_risk_count_latest, l_control_count_latest,
           l_classification


    from   amw_process

    where  process_id = p_process_id
    and    (end_date is null or end_date > l_sysdate);
Line: 832

       insert into amw_process (PROCESS_ID,
                                ITEM_TYPE,
                                NAME,
                                PROCESS_CODE,
                                REVISION_NUMBER,
                                PROCESS_REV_ID,
                                APPROVAL_STATUS,
                                START_DATE,
                                CONTROL_COUNT,
                                RISK_COUNT,
                                ORG_COUNT,
                                SIGNIFICANT_PROCESS_FLAG,
                                STANDARD_PROCESS_FLAG,
                                CERTIFICATION_STATUS,
                                PROCESS_CATEGORY,
                                PROCESS_OWNER_ID,
                                FINANCE_OWNER_ID,
                                APPLICATION_OWNER_ID,
                                STANDARD_VARIATION,
                                LAST_UPDATE_DATE,
                                LAST_UPDATED_BY,
                                CREATION_DATE,
                                CREATED_BY,
                                LAST_UPDATE_LOGIN,
                                OBJECT_VERSION_NUMBER,
                                DELETION_DATE,
                                PROCESS_TYPE,
                                CONTROL_ACTIVITY_TYPE,
                                ATTRIBUTE_CATEGORY,
                                ATTRIBUTE1,
                                ATTRIBUTE2,
                                ATTRIBUTE3,
                                ATTRIBUTE4,
                                ATTRIBUTE5,
                                ATTRIBUTE6,
                                ATTRIBUTE7,
                                ATTRIBUTE8,
                                ATTRIBUTE9,
                                ATTRIBUTE10,
                                ATTRIBUTE11,
                                ATTRIBUTE12,
                                ATTRIBUTE13,
                                ATTRIBUTE14,
                                ATTRIBUTE15,
                                CREATED_FROM,
                                PROGRAM_ID,
                                PROGRAM_APPLICATION_ID,
                                REQUEST_ID,
                                PROGRAM_UPDATE_DATE,
                                RISK_COUNT_LATEST,
                                CONTROL_COUNT_LATEST,
                                CLASSIFICATION)

                VALUES
                                (l_process_id,
                                 l_item_type,
                                 l_name,
                                 l_process_code,
                                 l_revision_number + 1,
                                 AMW_PROCESS_S.nextval,
                                 'D',
                                 l_sysdate,
                                 l_control_count,
                                 l_risk_count,
                                 l_org_count,
                                 l_significant_process_flag,
                                 l_standard_process_flag,
                                 l_certification_status,
                                 l_process_category,
                                 l_process_owner_id,
                                 l_finance_owner_id,
                                 l_application_owner_id,
                                 l_standard_variation,
                                 l_sysdate,
                                 G_USER_ID,
                                 l_sysdate,
                                 G_USER_ID,
                                 G_LOGIN_ID,
                                 1,
                                 l_deletion_date,
                                 l_process_type,
                                 l_control_activity_type,
                                 l_attribute_category,
                                 l_attribute1,
                                 l_attribute2,
                                 l_attribute3,
                                 l_attribute4,
                                 l_attribute5,
                                 l_attribute6,
                                 l_attribute7,
                                 l_attribute8,
                                 l_attribute9,
                                 l_attribute10,
                                 l_attribute11,
                                 l_attribute12,
                                 l_attribute13,
                                 l_attribute14,
                                 l_attribute15,
                                 l_created_from,
                                 l_program_id,
                                 l_program_application_id,
                                 l_request_id,
                                 l_program_update_date,
                                 l_risk_count_latest,
                                 l_control_count_latest,
                                 l_classification)
                RETURNING
                                 PROCESS_REV_ID
                INTO
                                 l_new_process_rev_id;
Line: 947

       update amw_process set
              last_update_date = l_sysdate,
              last_updated_by = G_USER_ID,
              last_update_login = G_LOGIN_ID,
              end_date = l_sysdate,
              object_version_number = l_object_version_number + 1



       where
             process_id = p_process_id and
             revision_number = l_revision_number and
             object_version_number = l_object_version_number;
Line: 962

       /* The only reason why the above insert could fail is:
        * The object version number had already been incremented
        * By some other process and thus the where clause failed to
        * update any row
        */
       if(sql%notfound)
       then
         raise FND_API.G_EXC_ERROR;
Line: 974

      select display_name, description, language, source_lang

      into   l_display_name, l_description, l_language, l_source_lang

      from   amw_process_names_tl

      where  process_id      = l_process_id and
              revision_number = l_revision_number and
             language = userenv('LANG');
Line: 992

      insert into amw_process_names_tl
      (
          process_id
         ,revision_number
         ,process_rev_id
         ,display_name
         ,description
         ,language
         ,source_lang
         ,creation_date
         ,created_by
         ,last_update_date
         ,last_updated_by
         ,last_update_login
         ,object_version_number
      )
      select
          l_process_id
         ,l_revision_number+1
         ,l_new_process_rev_id
         ,l_display_name
         ,l_description
         ,L.LANGUAGE_CODE
         ,USERENV('LANG')
         ,l_sysdate
         ,g_user_id
         ,l_sysdate
         ,g_user_id
         ,g_login_id
         ,1
      from FND_LANGUAGES L
      where L.INSTALLED_FLAG in ('I', 'B');
Line: 1032

                                  X_last_update_login => g_login_id,
                                  X_program_id      => FND_GLOBAL.CONC_PROGRAM_ID,
                                  X_request_id      => FND_GLOBAL.conc_request_id);
Line: 1050

/* this procedure updates the instance_id in the
 * amw_approved_hierarchy table if necessary
 * it should be called after a link is inserted in the
 * latest hierarchy (or an instance_id is updated)
 * the reason is that: the child order numbers of any
 * link in the latest and approved hierarchies MUST MATCH
 */
procedure update_appr_ch_ord_num_if_reqd
(p_org_id in number,
 p_parent_id in number,
 p_child_id in number,
 p_instance_id in number)

is

l_dummy pls_integer;
Line: 1069

  select 1 into l_dummy from amw_approved_hierarchies
  where parent_id = p_parent_id
  and   child_id   = p_child_id
  and   end_date is null
  and   ((-1 = p_org_id and (organization_id is null or organization_id = -1)) OR
         (p_org_id <> -1 and organization_id = p_org_id));
Line: 1076

  update amw_approved_hierarchies set
         last_update_date = sysdate,
         last_updated_by = G_USER_ID,
         last_update_login = G_LOGIN_ID,
         child_order_number = p_instance_id,
         object_version_number = object_version_number + 1
  where  parent_id = p_parent_id
  and    child_id  = p_child_id
  and    end_date is null
  and    ((-1 = p_org_id and (organization_id is null or organization_id = -1)) OR
         (p_org_id <> -1 and organization_id = p_org_id));
Line: 1094

end update_appr_ch_ord_num_if_reqd;
Line: 1104

select approval_status into l_approval_status
from amw_process where process_id = p_process_id and
end_date is null;
Line: 1142

    (select parent_process_id,
            child_process_id,
            child_order_number from AMW_LATEST_HIERARCHY_RL_V
       start with parent_process_id = -1 and
			    parent_approval_status = 'A'
       connect by prior child_process_id = parent_process_id and
                      child_approval_status = 'A' )
	 MINUS

     (select   parent_process_id,
               child_process_id,
               child_order_number
       from AMW_CURR_APP_HIERARCHY_RL_V);
Line: 1219

  insert into amw_latest_hierarchies(ORGANIZATION_ID,
                                   PARENT_ID,
                                   CHILD_ID,
                                   CHILD_ORDER_NUMBER,
                                   LAST_UPDATE_DATE,
                                   LAST_UPDATED_BY,
                                   LAST_UPDATE_LOGIN,
                                   CREATION_DATE,
                                   CREATED_BY,
                                   OBJECT_VERSION_NUMBER
                                   )
         VALUES                   (-1,
                                   p_parent_process_id,
                                   p_child_process_id,
                                   AMW_CHILD_ORDER_S.nextval,
                                   l_sysdate,
                                   g_user_id,
                                   g_login_id,
                                   l_sysdate,
                                   g_user_id,
                                   1)
         returning                CHILD_ORDER_NUMBER
         into                     l_child_order_number;
Line: 1244

  update_appr_ch_ord_num_if_reqd(-1, p_parent_process_id, p_child_process_id,
                                 l_child_order_number);
Line: 1248

  /* update the denorm table
   * can throw an amw_processing_exception, so it has been handled.
   */
  update_denorm_add_child(p_parent_id => p_parent_process_id,
                          p_child_id  => p_child_process_id,
                          l_sysdate   => l_sysdate);
Line: 1265

      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
                   (-1,
                    a_link.parent_process_id,
                    a_link.child_process_id,
                    l_sysdate,
                    a_link.child_order_number,
                    l_sysdate,
                    g_user_id,
                    g_login_id,
                    l_sysdate,
                    g_user_id,
                    1);
Line: 1291

    /* now update the denorm table */
    update_approved_denorm(-1,l_sysdate);
Line: 1299

  update_latest_control_counts(p_parent_process_id);
Line: 1300

  update_latest_risk_counts(p_parent_process_id);
Line: 1374

procedure delete_child(

p_parent_process_id in number,
p_child_process_id in number,
l_sysdate in Date default sysdate,
x_return_status out nocopy varchar2,
x_msg_count out nocopy number,
x_msg_data out nocopy varchar2)

is

  l_api_name constant varchar2(30) := 'delete_child';
Line: 1393

    (select  parent_process_id, child_process_id
       from AMW_CURR_APP_HIERARCHY_RL_V
       where parent_process_id is not null)
    MINUS
    (select parent_process_id, child_process_id
       from AMW_CURR_APP_HIERARCHY_RL_V
       start with parent_process_id = -1
	   connect by prior child_process_id = parent_process_id);
Line: 1455

  /* update the latest hierarchy table
   * first we update the denorm table
   */
  delete from amw_latest_hierarchies

  where
         parent_id = p_parent_process_id and
         child_id  = p_child_process_id  and
         (organization_id is null or organization_id = -1);
Line: 1472

  update_denorm(p_org_id => -1,
                l_sysdate =>l_sysdate);
Line: 1483

     select 1 into l_dummy from amw_approved_hierarchies
     where (organization_id is null or organization_id = -1)
     and   parent_id = -1
     and   child_id = p_child_process_id
     and   end_date is null;
Line: 1489

     delete from amw_approved_hierarchies
     where parent_id = -1
     and   child_id = p_child_process_id
     and   (organization_id is null or organization_id = -1)
     and   end_date is null;
Line: 1497

       update amw_approved_hierarchies
       set end_date = l_sysdate,
           object_version_number = object_version_number + 1
       where (organization_id is null or organization_id = -1)
       and parent_id = defunct_link.parent_process_id
       and child_id = defunct_link.child_process_id
       and end_date is null;
Line: 1506

     /* finally update the denorm table */
     update_approved_denorm(-1,l_sysdate);
Line: 1518

  update_latest_control_counts(p_parent_process_id);
Line: 1519

  update_latest_risk_counts(p_parent_process_id);
Line: 1546

                             p_procedure_name =>   'delete_child',
            	             p_error_text => x_msg_data);
Line: 1572

end delete_child;
Line: 1588

       select locked_process_id from amw_process_locks
       where (organization_id is null or organization_id=-1) and
             locked_process_id=l_process_id;
Line: 1634

  select process_id into l_process_id from amw_process
  where name = p_name
  and   item_type = p_item_type
  and   end_date is null;
Line: 1655

  select 1 into l_dummy from amw_process
  where name = p_name
  and  item_type = p_item_type
  and  end_date is null;
Line: 1688

  select l_prefix || to_char(AMW_PROCESS_CODE_S.nextval) into l_code from dual;
Line: 1690

  select 1 into l_dummy from amw_process
  where  process_code = l_code
  and    end_date is null;
Line: 1721

  insert into amw_process       (PROCESS_ID,
                                ITEM_TYPE,
                                NAME,
                                PROCESS_CODE,
                                REVISION_NUMBER,
                                PROCESS_REV_ID,
                                APPROVAL_STATUS,
                                START_DATE,
                                CONTROL_COUNT,
                                RISK_COUNT,
                                ORG_COUNT,
                                LAST_UPDATE_DATE,
                                LAST_UPDATED_BY,
                                CREATION_DATE,
                                CREATED_BY,
                                LAST_UPDATE_LOGIN,
                                OBJECT_VERSION_NUMBER,
                                PROCESS_TYPE,
                                PROGRAM_ID,
                                REQUEST_ID,
                                PROGRAM_UPDATE_DATE,
                                RISK_COUNT_LATEST,
                                CONTROL_COUNT_LATEST,
                                SIGNIFICANT_PROCESS_FLAG,
                                STANDARD_PROCESS_FLAG,
                                PROCESS_CATEGORY)

                VALUES
                                (AMW_PROCESS_S.nextval,
                                 p_item_type,
                                 p_name,
                                 l_new_code,
                                 1,
                                 AMW_PROCESS_S.nextval,
                                 'D',
                                 g_sysdate,
                                 0,
                                 0,
                                 0,
                                 g_sysdate,
                                 G_USER_ID,
                                 g_sysdate,
                                 G_USER_ID,
                                 G_LOGIN_ID,
                                 1,
                                 'P',
                                 FND_GLOBAL.CONC_PROGRAM_ID,
                                 FND_GLOBAL.CONC_REQUEST_ID,
                                 DECODE(FND_GLOBAL.CONC_PROGRAM_ID,null,null,g_sysdate),
                                 0,
                                 0,
                                 'Y',
                                 'Y',
                                 'R')
                RETURNING
                                 PROCESS_ID, PROCESS_REV_ID
                INTO
                                 l_process_id, l_process_rev_id;
Line: 1781

  insert into amw_process_names_tl
      (
          process_id
         ,revision_number
         ,process_rev_id
         ,display_name
         ,description
         ,language
         ,source_lang
         ,creation_date
         ,created_by
         ,last_update_date
         ,last_updated_by
         ,last_update_login
         ,object_version_number
      )
      select
          l_process_id
         ,1
         ,l_process_rev_id
         ,p_display_name
         ,p_description
         ,L.LANGUAGE_CODE
         ,USERENV('LANG')
         ,g_sysdate
         ,g_user_id
         ,g_sysdate
         ,g_user_id
         ,g_login_id
         ,1
      from FND_LANGUAGES L
      where L.INSTALLED_FLAG in ('I', 'B');
Line: 1819

function is_deleted_process(p_process_id in number)
return boolean is
l_dummy pls_integer;
Line: 1823

  select 1 into l_dummy from amw_process
  where process_id = p_process_id
  and   end_date is null
  and   deletion_date is not null;
Line: 1836

end is_deleted_process;
Line: 1857

    select activity_item_type, activity_name,
           activity_display_name, activity_description,
           instance_id
    from   amw_wf_process_hierarchy_vl
    where  process_name = l_name and
           process_item_type = l_item_type;
Line: 1869

    (select activity_name, activity_item_type
     from amw_wf_process_hierarchy_vl
     where process_name = l_name
     and   process_item_type = l_item_type
    )
    MINUS
    (select child_name activity_name, child_item_type activity_item_type
     from   amw_latest_hierarchy_rl_v
     where  parent_name = l_name
     and    parent_item_type = l_item_type
    );
Line: 1885

    (select child_name, child_item_type
     from   amw_latest_hierarchy_rl_v
     where  parent_name = l_name
     and    parent_item_type = l_item_type
    )
    MINUS
    (select activity_name child_name, activity_item_type child_item_type
     from amw_wf_process_hierarchy_vl
     where process_name = l_name
     and   process_item_type = l_item_type
    );
Line: 1902

    (select parent_process_id,
            child_process_id,
            child_order_number from AMW_LATEST_HIERARCHY_RL_V
       start with parent_process_id = -1 and
			    parent_approval_status = 'A'
       connect by prior child_process_id = parent_process_id and
                      child_approval_status = 'A' )
	 MINUS

     (select   parent_process_id,
               child_process_id,
               child_order_number
       from AMW_CURR_APP_HIERARCHY_RL_V);
Line: 1985

      select 1 into l_dummy from amw_latest_hierarchies
      where parent_id = p_parent_process_id
      and   child_id = l_process_id
      and   (organization_id is null or organization_id = -1);
Line: 1992

          insert into amw_latest_hierarchies (ORGANIZATION_ID,
                                            PARENT_ID,
                                            CHILD_ID,
                                            CHILD_ORDER_NUMBER,
                                            LAST_UPDATE_DATE,
                                            LAST_UPDATED_BY,
                                            LAST_UPDATE_LOGIN,
                                            CREATION_DATE,
                                            CREATED_BY,
                                            OBJECT_VERSION_NUMBER
                                            )
                 values                     (-1,
                                              p_parent_process_id,
                                              l_process_id,
                                              p_instance_id,
                                              g_sysdate,
                                              g_user_id,
                                              g_login_id,
                                              g_sysdate,
                                              g_user_id,
                                              1);
Line: 2013

          update_appr_ch_ord_num_if_reqd(-1, p_parent_process_id,
                                         l_process_id,
                                         p_instance_id);
Line: 2049

      if(is_deleted_process(l_process_id))
      then
        raise amw_process_deleted_exception;
Line: 2079

        select 1 into l_dummy from amw_latest_hierarchies
        where parent_id = p_parent_process_id
        and   child_id = l_process_id
        and   (organization_id is null or organization_id = -1);
Line: 2085

          insert into amw_latest_hierarchies (ORGANIZATION_ID,
                                            PARENT_ID,
                                            CHILD_ID,
                                            CHILD_ORDER_NUMBER,
                                            LAST_UPDATE_DATE,
                                            LAST_UPDATED_BY,
                                            LAST_UPDATE_LOGIN,
                                            CREATION_DATE,
                                            CREATED_BY,
                                            OBJECT_VERSION_NUMBER)
          values                            (-1,
                                              p_parent_process_id,
                                              l_process_id,
                                              p_instance_id,
                                              g_sysdate,
                                              g_user_id,
                                              g_login_id,
                                              g_sysdate,
                                              g_user_id,
                                              1);
Line: 2105

          update_appr_ch_ord_num_if_reqd(-1, p_parent_process_id,
                                         l_process_id,
                                         p_instance_id);
Line: 2157

          delete from amw_latest_hierarchies
          where (organization_id is null or organization_id = -1)
          and parent_id = l_process_id
          and child_id  = cur_child_id;
Line: 2191

      select approval_status into l_approval_status
      from   amw_process
      where  process_id = l_process_id
      and    end_date is null;
Line: 2200

          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
                      (-1,
                       a_link.parent_process_id,
                       a_link.child_process_id,
                       g_sysdate,
                       a_link.child_order_number,
                       g_sysdate,
                       g_user_id,
                       g_login_id,
                       g_sysdate,
                       g_user_id,
                       1);
Line: 2226

       /* now update the denorm table */
       update_approved_denorm(-1,g_sysdate);
Line: 2228

       update_appr_control_counts;
Line: 2229

       update_appr_risk_counts;
Line: 2250

  insert into amw_latest_hierarchies (organization_id,
                                    parent_id,
                                    child_id,
                                    child_order_number,
                                    LAST_UPDATE_DATE,
                                    LAST_UPDATED_BY,
                                    LAST_UPDATE_LOGIN,
                                    CREATION_DATE,
                                    CREATED_BY,
                                    OBJECT_VERSION_NUMBER)
  values
                                   (-1,
                                    p_parent_process_id,
                                    l_process_id,
                                    p_instance_id,
                                    g_sysdate,
                                    g_user_id,
                                    g_login_id,
                                    g_sysdate,
                                    g_user_id,
                                    1);
Line: 2307

	p_update_denorm_count IN VARCHAR2 := 'Y',
	x_return_status		out nocopy varchar2,
	x_msg_count		out nocopy number,
	x_msg_data		out nocopy varchar2)
is
  iStart pls_integer := 1;
Line: 2331

    visited_tbl.delete;
Line: 2352

    select display_name, description, AMW_CHILD_ORDER_S.nextval
    into   cur_display_name, cur_description, cur_instance_id
    from   wf_activities_vl
    where  name = cur_name
    and    item_type = cur_item_type
    and    end_date is null;
Line: 2374

  IF p_update_denorm_count = 'Y' THEN
  /* update the denorm tables .. */
  update_denorm(p_org_id => -1,
                l_sysdate    => g_sysdate);
Line: 2380

  /* then update the risk_control_counts */
  update_all_latest_rc_counts(p_mode => 'RC');
Line: 2408

    when amw_process_deleted_exception then
         ROLLBACK;
Line: 2412

         fnd_message.set_name('AMW','AMW_DELETED_PROC_MODIF');
Line: 2487

    (select parent_process_id,
            child_process_id,
            child_order_number from AMW_LATEST_HIERARCHY_RL_V
       start with parent_process_id = -1 and
			    parent_approval_status = 'A'
       connect by prior child_process_id = parent_process_id and
                      child_approval_status = 'A' )
	 MINUS

     (select   parent_process_id,
               child_process_id,
               child_order_number
       from AMW_CURR_APP_HIERARCHY_RL_V);
Line: 2571

     SELECT AMW_CHILD_ORDER_S.nextval INTO L_CHILD_ORDER FROM DUAL;
Line: 2576

  insert into amw_latest_hierarchies(ORGANIZATION_ID,
                                   PARENT_ID,
                                   CHILD_ID,
                                   CHILD_ORDER_NUMBER,
                                   LAST_UPDATE_DATE,
                                   LAST_UPDATED_BY,
                                   LAST_UPDATE_LOGIN,
                                   CREATION_DATE,
                                   CREATED_BY,
                                   OBJECT_VERSION_NUMBER)
         VALUES                   (-1,
		                   p_parent_process_id,
                                   p_child_process_id,
                                   L_CHILD_ORDER,
                                   l_sysdate,
                                   g_user_id,
                                   g_login_id,
                                   l_sysdate,
                                   g_user_id,
                                   1)
         returning                CHILD_ORDER_NUMBER
         into                     l_child_order_number;
Line: 2600

  update_appr_ch_ord_num_if_reqd(-1, p_parent_process_id, p_child_process_id,
                                 l_child_order_number);
Line: 2604

  /* update the denorm table
   * can throw an amw_processing_exception, so it has been handled.
   */
   ---COMMENTING THE BELOW ... DON'T NEED THIS FROM WEBADI
   /*
   update_denorm_add_child(p_parent_id => p_parent_process_id,
                          p_child_id  => p_child_process_id,
                          l_sysdate   => l_sysdate);
Line: 2618

  select approval_status into l_approval_status
  from amw_process where process_id = p_child_process_id and
  end_date is null;
Line: 2626

      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
                   (-1,
                    a_link.parent_process_id,
                    a_link.child_process_id,
                    l_sysdate,
                    a_link.child_order_number,
                    l_sysdate,
                    g_user_id,
                    g_login_id,
                    l_sysdate,
                    g_user_id,
                    1);
Line: 2652

    /* now update the denorm table */
    update_approved_denorm(-1,l_sysdate);
Line: 2727

/* update the approved risk counts for all processes above
 * p_process_id in RL Approved Hierarchy
 * Call this ONLY AFTER making the denorm tables reflect
 * the current denormed approved hierarchy
 * This can be called for post approval processing
 *** BE CAREFUL WITH THE USE OF THIS PROCEDURE ***
 * This process only affects procedures in the approved_hierarchy
 * The approved_hierarchy is always connected to the root
 * It is possible that a process was approved and yet not present
 * in the approved hierarchy. Thus after some process P was approved
 * and its child Q (approved earlier) was added to the approved
 * hierarchy WHEN P was approved: IF THIS PROCEDURE WAS CALLED ONLY FOR
 * P it will not affect Q and the final result would be INCORRECT.
 */
procedure update_approved_risk_counts(p_process_id in number)
is


cursor c is
(select process_id from amw_process where process_id in
                 ((select parent_child_id
                   from amw_proc_hierarchy_denorm
                   where process_id = p_process_id
                   and up_down_ind = 'U'
                   and hierarchy_type = 'A'
                   )
                   union all
                   (select p_process_id from dual)));
Line: 2764

  update amw_process
  set    risk_count      = (select count(*) from (
                            select distinct risk_id from amw_risk_associations
                            where pk1 in ( ( select parent_child_id
                            from amw_proc_hierarchy_denorm
                            where process_id = x(ctr)
                            and up_down_ind = 'D'
                            and hierarchy_type = 'A') union all (select x(ctr) from dual) )
                            and approval_date is not null
                            and deletion_approval_date is null
                            and object_type = 'PROCESS'
                            ) ),
         object_version_number = object_version_number + 1,
         last_update_date = sysdate,
         last_updated_by = G_USER_ID,
         last_update_login = G_LOGIN_ID
where process_id = x(ctr)
and approval_date is not null
and approval_end_date is null
and process_id <> -1;
Line: 2791

end update_approved_risk_counts;
Line: 2794

/* update the approved control counts for all processes above
 * p_process_id in RL Approved Hierarchy
 * Call this ONLY AFTER making the denorm tables reflect
 * the current denormed approved hierarchy
 * This can be called for post approval processing
 *** BE CAREFUL WITH THE USE OF THIS PROCEDURE ***
 * This process only affects procedures in the approved_hierarchy
 * The approved_hierarchy is always connected to the root
 * It is possible that a process was approved and yet not present
 * in the approved hierarchy. Thus after some process P was approved
 * and its child Q (approved earlier) was added to the approved
 * hierarchy WHEN P was approved: IF THIS PROCEDURE WAS CALLED ONLY FOR
 * P it will not affect Q and the final result would be INCORRECT.
 */
procedure update_approved_control_counts(p_process_id in number)
is
cursor c is
(select process_id from amw_process where process_id in
                 ((select parent_child_id
                   from amw_proc_hierarchy_denorm
                   where process_id = p_process_id
                   and up_down_ind = 'U'
                   and hierarchy_type = 'A'
                   )
                   union all
                   (select p_process_id from dual)));
Line: 2830

  update amw_process
  set    control_count      = (select count(*) from (
                            select distinct control_id from amw_control_associations
                            where pk1 in ( ( select parent_child_id
                            from amw_proc_hierarchy_denorm
                            where process_id = x(ctr)
                            and up_down_ind = 'D'
                            and hierarchy_type = 'A') union all (select x(ctr) from dual) )
                            and approval_date is not null
                            and deletion_approval_date is null
                            and object_type = 'RISK'
                            ) ),
         object_version_number = object_version_number + 1,
         last_update_date = sysdate,
         last_updated_by = G_USER_ID,
         last_update_login = G_LOGIN_ID
where process_id = x(ctr)
and approval_date is not null
and approval_end_date is null
and process_id <> -1;
Line: 2857

end update_approved_control_counts;
Line: 2861

/* updates risk counts for every process in
 * the approved hierarchy
 */
procedure update_appr_risk_counts is

cursor c is
(select process_id from amw_process where process_id in
                  (select parent_child_id
                   from amw_proc_hierarchy_denorm
                   where process_id = -1
                   and up_down_ind = 'D'
                   and hierarchy_type = 'A'
                   ));
Line: 2883

  update amw_process
  set    risk_count      = (select count(*) from (
                            select distinct risk_id from amw_risk_associations
                            where pk1 in ( ( select parent_child_id
                            from amw_proc_hierarchy_denorm
                            where process_id = x(ctr)
                            and up_down_ind = 'D'
                            and hierarchy_type = 'A') union all (select x(ctr) from dual) )
                            and approval_date is not null
                            and deletion_approval_date is null
                            and object_type = 'PROCESS'
                            ) ),
         object_version_number = object_version_number + 1,
         last_update_date = sysdate,
         last_updated_by = G_USER_ID,
         last_update_login = G_LOGIN_ID
where process_id = x(ctr)
and approval_date is not null
and approval_end_date is null
and process_id <> -1;
Line: 2910

end update_appr_risk_counts;
Line: 2912

procedure update_appr_control_counts is
cursor c is
(select process_id from amw_process where process_id in
                  (select parent_child_id
                   from amw_proc_hierarchy_denorm
                   where process_id = -1
                   and up_down_ind = 'D'
                   and hierarchy_type = 'A'
                   ));
Line: 2932

update amw_process
set control_count = (select count(*) from (
                            select distinct control_id from amw_control_associations
                            where pk1 in (  (select parent_child_id
                            from amw_proc_hierarchy_denorm
                            where process_id = x(ctr)
                            and up_down_ind = 'D'
                            and hierarchy_type = 'A') union all (select x(ctr) from dual) )
                            and approval_date is not null
                            and deletion_approval_date is null
                            and object_type = 'RISK'
                            ) )
    ,object_version_number = object_version_number + 1,
         last_update_date = sysdate,
         last_updated_by = G_USER_ID,
         last_update_login = G_LOGIN_ID
where process_id = x(ctr)
and approval_date is not null
and approval_end_date is null
and process_id <> -1;
Line: 2960

end update_appr_control_counts;
Line: 2965

/* update the latest control counts for all processes above
 * p_process_id in RL
 * Call this ONLY AFTER making the denorm tables reflect
 * the current denormed hierarchy
 */
procedure update_latest_control_counts(p_process_id in number)
is

cursor c is
(select process_id from amw_process where process_id in
                  (select parent_child_id
                   from amw_proc_hierarchy_denorm
                   where process_id = p_process_id
                   and up_down_ind = 'U'
                   and hierarchy_type = 'L'
                   ) union all
                   (select p_process_id from dual));
Line: 2991

  update amw_process
  set    control_count_latest      = (select count(*) from (
                            select distinct control_id from amw_control_associations
                            where pk1 in ( ( select parent_child_id
                            from amw_proc_hierarchy_denorm
                            where process_id = x(ctr)
                            and up_down_ind = 'D'
                            and hierarchy_type = 'L') union all (select x(ctr) from dual) )
                            and deletion_date is null
                            and object_type = 'RISK'
                            ) )
         --unsure whether FWK validation may throw error if ovn is incremented here
         --so am removing it here.
         --.object_version_number = object_version_number + 1,
         ,last_update_date = sysdate
         ,last_updated_by = G_USER_ID
         ,last_update_login = G_LOGIN_ID
where process_id = x(ctr)
and end_date is null
and process_id <> -1;
Line: 3020

end update_latest_control_counts;
Line: 3023

procedure update_latest_risk_counts(p_process_id in number)
is
cursor c is
(select process_id from amw_process where process_id in
                  (select parent_child_id
                   from amw_proc_hierarchy_denorm
                   where process_id = p_process_id
                   and up_down_ind = 'U'
                   and hierarchy_type = 'L'
                   ) union all
                   (select p_process_id from dual));
Line: 3045

update amw_process
set risk_count_latest =    (select count(*) from (
                            select distinct risk_id from amw_risk_associations
                            where pk1 in (  (select parent_child_id
                            from amw_proc_hierarchy_denorm
                            where process_id = x(ctr)
                            and up_down_ind = 'D'
                            and hierarchy_type = 'L') union all (select x(ctr) from dual) )
                            and deletion_date is null
                            and object_type = 'PROCESS'
                            ) )
     --,object_version_number = object_version_number + 1
     	      ,last_update_date = sysdate
              ,last_updated_by = G_USER_ID
              ,last_update_login = G_LOGIN_ID
where process_id = x(ctr)
and end_date is null
and process_id <> -1;
Line: 3070

end update_latest_risk_counts;
Line: 3077

procedure update_rc_latest_counts(p_process_id in number,
                                  x_return_status out nocopy varchar2,
                                  x_msg_count out nocopy number,
                                  x_msg_data out nocopy varchar2)

is




  l_api_name constant varchar2(30) := 'update_rc_latest_counts';
Line: 3103

  update_latest_risk_counts(p_process_id => p_process_id);
Line: 3104

  update_latest_control_counts(p_process_id => p_process_id);
Line: 3112

end update_rc_latest_counts;
Line: 3116

/* update the latest risk-control counts for ALL processes in RL */
procedure update_all_latest_rc_counts(p_mode in varchar2)

is
cursor c is
(select process_id from amw_process where end_date is null and process_id <> -1);
Line: 3134

      update amw_process
      set risk_count_latest = (select count(*) from (
                             select distinct risk_id
                             from amw_risk_associations
                             where pk1 in ((select parent_child_id
                                           from amw_proc_hierarchy_denorm
                                           where process_id = x(ctr)
                                           and up_down_ind = 'D'
                                           and hierarchy_type = 'L') union all (select x(ctr) from dual) )
                                           and deletion_date is null
                                           and object_type = 'PROCESS'
                                          )),
        object_version_number = object_version_number + 1
        ,last_update_date = sysdate
	,last_updated_by = G_USER_ID
        ,last_update_login = G_LOGIN_ID
    where process_id = x(ctr)
    and end_date is null;
Line: 3156

      update amw_process
      set control_count_latest = (select count(*) from

                               (select distinct control_id from amw_control_associations
                                where pk1 in ((select parent_child_id
                                              from amw_proc_hierarchy_denorm
                                              where process_id = x(ctr)
                                              and up_down_ind = 'D'
                                              and hierarchy_type = 'L') union all (select x(ctr) from dual) )
                                and deletion_date is null
                                and object_type = 'RISK'
                                )),
        object_version_number = object_version_number + 1
        ,last_update_date = sysdate
	,last_updated_by = G_USER_ID
        ,last_update_login = G_LOGIN_ID
    where process_id = x(ctr)
    and end_date is null;
Line: 3177

      update amw_process
            set risk_count_latest = (select count(*) from (
                                   select distinct risk_id
                                   from amw_risk_associations
                                   where pk1 in ((select parent_child_id
                                                 from amw_proc_hierarchy_denorm
                                                 where process_id = x(ctr)
                                                 and up_down_ind = 'D'
                                                 and hierarchy_type = 'L') union all (select x(ctr) from dual) )
                                                 and deletion_date is null
                                                 and object_type = 'PROCESS'
                                                )),

               control_count_latest = (select count(*) from

			                (select distinct control_id from amw_control_associations
			                 where pk1 in ((select parent_child_id
			                               from amw_proc_hierarchy_denorm
			                               where process_id = x(ctr)
			                               and up_down_ind = 'D'
			                               and hierarchy_type = 'L') union all (select x(ctr) from dual) )
			                 and deletion_date is null
			                 and object_type = 'RISK')),
              object_version_number = object_version_number + 1
              ,last_update_date = sysdate
	      ,last_updated_by = G_USER_ID
              ,last_update_login = G_LOGIN_ID
          where process_id = x(ctr)
          and end_date is null;
Line: 3219

end update_all_latest_rc_counts;
Line: 3231

/* Update the org_counts for all approved processes in RL
 * Amit, in my opinion we need something that does it per process
 * rather than for everything -- pls, give this a thought
 */
procedure update_all_org_counts

is
cursor c is (select process_id from amw_process where
             approval_date is not null
	     and approval_end_date is null
             and process_id <> -1);
Line: 3251

update amw_process
set org_count = (select count(*) from
                (select distinct organization_id
                from amw_process_organization
                where process_id = x(ctr)
                and end_date is null
                and (deletion_date is null or (deletion_date is not null and approval_date is null)))),
    object_version_number = object_version_number + 1
    ,last_update_date = sysdate
    ,last_updated_by = G_USER_ID
    ,last_update_login = G_LOGIN_ID
where process_id = x(ctr)
and approval_date is not null
and approval_end_date is null;
Line: 3267

end update_all_org_counts;
Line: 3270

/* update the org count for p_process_id */
procedure update_org_count(p_process_id in number)

is

begin
update amw_process
set org_count = (select count(*) from
                (select distinct organization_id
                from amw_process_organization
                where process_id = p_process_id
                and end_date is null
                and (deletion_date is null or (deletion_date is not null and approval_date is null)))),
    object_version_number = object_version_number + 1
    ,last_update_date = sysdate
    ,last_updated_by = G_USER_ID
    ,last_update_login = G_LOGIN_ID
where approval_date is not null
and approval_end_date is null
and process_id <> -1  --retained for safety
and process_id = p_process_id;
Line: 3299

end update_org_count;
Line: 3307

 procedure update_attachments(p_old_prev_id in varchar2,
                              p_new_prev_id in varchar2,
                              x_return_status out nocopy varchar2,
			      x_msg_count out nocopy number,
			      x_msg_data out nocopy varchar2)

 is
  l_api_name constant varchar2(30) := 'update_attachments';
Line: 3330

   FND_ATTACHED_DOCUMENTS2_PKG.delete_attachments(X_entity_name => 'AMW_PROCESS',
                                                  X_pk1_value   => p_old_prev_id);
Line: 3340

                              X_last_update_login => g_login_id,
                              X_program_id        => FND_GLOBAL.CONC_PROGRAM_ID,
                              X_request_id        => FND_GLOBAL.conc_request_id);
Line: 3347

   FND_ATTACHED_DOCUMENTS2_PKG.delete_attachments(X_entity_name => 'AMW_PROCESS',
                                                  X_pk1_value   => p_new_prev_id);
Line: 3360

 end update_attachments;
Line: 3377

select amw_process_name_s.nextval into l_name from dual;
Line: 3385

update amw_process
set PROCESS_TYPE = decode(p_control_type, 'A', 'C', 'M', 'C', 'B', 'C', PROCESS_TYPE),
CONTROL_ACTIVITY_TYPE = decode(p_control_type, '-1', CONTROL_ACTIVITY_TYPE, p_control_type)
where process_id = l_pid
and end_date is null;
Line: 3416

select process_id
into l_pid
from AMW_LATEST_REVISIONS_V
where display_name = p_display_name;
Line: 3461

    select person_party_id
    into l_party_id
    from fnd_user
    where user_id = G_USER_ID;
Line: 3532

cursor_select   INTEGER;
Line: 3538

query_to_exec := 'select process_id from AMW_CURRENT_APPRVD_REV_V where process_id = -1 and '||p_predicate;
Line: 3539

cursor_select := DBMS_SQL.OPEN_CURSOR;
Line: 3540

DBMS_SQL.PARSE(cursor_select, query_to_exec, DBMS_SQL.NATIVE);
Line: 3541

cursor_execute := DBMS_SQL.EXECUTE(cursor_select);
Line: 3542

IF DBMS_SQL.FETCH_ROWS(cursor_select) > 0 THEN
	l_hasaccess := 'Y';
Line: 3547

DBMS_SQL.CLOSE_CURSOR(cursor_select);
Line: 3566

	--updates latest hier denorm
	amw_rl_hierarchy_pkg.update_denorm (-1, sysdate);
Line: 3568

	--updates approved hier denorm
	amw_rl_hierarchy_pkg.update_approved_denorm (-1, sysdate);
Line: 3571

	update amw_process
	set risk_count = null,
	control_count = null,
	risk_count_latest = null,
	control_count_latest = null;
Line: 3577

	--updates latest risk/control counts
	amw_rl_hierarchy_pkg.update_all_latest_rc_counts('RC');
Line: 3579

	--updates approved risk counts
	amw_rl_hierarchy_pkg.update_appr_risk_counts;
Line: 3581

	--updates approved control counts
	amw_rl_hierarchy_pkg.update_appr_control_counts;
Line: 3583

	-- update approved org counts
        amw_rl_hierarchy_pkg.update_all_org_counts;
Line: 3607

        select 1 into ret_val
        from dual
        where (exists
                (select parent_id from amw_latest_hierarchies
                where parent_id = p_process_id
                and (organization_id = -1 or organization_id is null)))
        or (exists
                (select child_id from amw_latest_hierarchies
                where child_id = p_process_id
                and (organization_id = -1 or organization_id is null)));
Line: 3639

           select child_id
           into l_dummy
           from amw_approved_hierarchies
           where parent_id = p_process_id
           and (organization_id is null or organization_id = -1)
           and (end_date is null or end_date > sysdate)
           and child_id not in
              (select child_id
              from amw_latest_hierarchies
              where parent_id = p_process_id
              and   (organization_id is null or organization_id = -1));
Line: 3653

                   select child_id
                   into l_dummy
                   from amw_latest_hierarchies
                   where parent_id = p_process_id
                   and   (organization_id is null or organization_id = -1)
                   and child_id not in
                       (select child_id
                       from amw_approved_hierarchies
                       where parent_id = p_process_id
                       and (organization_id is null or organization_id = -1)
                       and (end_date is null or end_date > sysdate));
Line: 3680

    select 1
    into l_dummy
    from amw_process
    where process_id = p_process_id
    and approval_status = 'A';
Line: 3724

select approval_status into appstatus from amw_process
where process_id = p_process_id and end_date is null;
Line: 3771

procedure delete_draft (p_process_id in number,
                        x_return_status out nocopy varchar2,
                        x_msg_count out nocopy number,
                        x_msg_data out nocopy varchar2) is

l_api_name constant varchar2(30) := 'delete_draft';
Line: 3783

             select parent_id
             from amw_latest_hierarchies
             where child_id = pid
             and   (organization_id is null or organization_id = -1);
Line: 3806

    select process_rev_id
    into previd from amw_process
    where process_id = p_process_id
    and end_date is null;
Line: 3827

                       	            p_procedure_name => 'delete_draft',
                                    p_error_text => err_msg);
Line: 3836

    delete from amw_process
    where process_id = p_process_id
    and end_date is null;
Line: 3840

    delete from amw_process_names_tl
    where process_rev_id = previd;
Line: 3843

    update amw_process
    set end_date = null
    where process_id = p_process_id
    and approval_date is not null
    and approval_end_date is null;
Line: 3851

    select standard_process_flag, process_rev_id
    into l_flag, previd from amw_process
    where process_id = p_process_id;
Line: 3857

            select 1 into l_dummy from dual
            where exists
            (select 1 from amw_process
            where standard_variation = previd
            and end_date is null);
Line: 3866

                       	            p_procedure_name => 'delete_draft',
                                    p_error_text => err_msg);
Line: 3879

    	  delete from amw_latest_hierarchies
    	  where parent_id = parent_rec.parent_id
    	  and child_id = p_process_id
    	  and (organization_id is null or organization_id = -1);
Line: 3886

    delete from amw_latest_hierarchies
    where parent_id = p_process_id
    and (organization_id is null or organization_id = -1);
Line: 3889

    delete from amw_process where process_id = p_process_id;
Line: 3890

    delete from amw_process_names_tl where process_rev_id = previd;
Line: 3896

delete from amw_risk_associations
where pk1 = p_process_id
and approval_date is null
and object_type = 'PROCESS';
Line: 3905

update amw_risk_associations
set deletion_date = null
where pk1 = p_process_id
and object_type = 'PROCESS'
and deletion_date is not null
and deletion_approval_date is null;
Line: 3916

delete from amw_control_associations
where pk1 = p_process_id
and approval_date is null
and object_type = 'RISK';
Line: 3925

update amw_control_associations
set deletion_date = null
where pk1 = p_process_id
and object_type = 'RISK'
and deletion_date is not null
and deletion_approval_date is null;
Line: 3936

delete from amw_acct_associations
where pk1 = p_process_id
and approval_date is null
and object_type = 'PROCESS';
Line: 3941

update amw_acct_associations
set deletion_date = null
where pk1 = p_process_id
and object_type = 'PROCESS'
and deletion_date is not null
and deletion_approval_date is null;
Line: 3949

delete from amw_objective_associations
where pk1 = p_process_id
and approval_date is null
and object_type in ('PROCESS', 'CONTROL');
Line: 3954

update amw_objective_associations
set deletion_date = null
where pk1 = p_process_id
and object_type in ('PROCESS', 'CONTROL')
and deletion_date is not null
and deletion_approval_date is null;
Line: 3962

delete from amw_significant_elements
where pk1 = p_process_id
and approval_date is null
and object_type = 'PROCESS';
Line: 3967

update amw_significant_elements
set deletion_date = null
where pk1 = p_process_id
and object_type = 'PROCESS'
and deletion_date is not null
and deletion_approval_date is null;
Line: 3975

FND_ATTACHED_DOCUMENTS2_PKG.delete_attachments(X_entity_name => 'AMW_PROCESS',
                                               X_pk1_value   => previd);
Line: 3981

amw_rl_hierarchy_pkg.update_denorm (-1, sysdate);
Line: 3988

  update_latest_risk_counts(p_process_id);
Line: 3993

  update_latest_control_counts(p_process_id);
Line: 4053

  select person_party_id
    into l_party_id
    from fnd_user
    where user_id = G_USER_ID;
Line: 4108

procedure delete_activities(p_parent_process_id in number,
			   			   p_child_id_string in varchar2,
	                       x_return_status out nocopy varchar2,
                           x_msg_count out nocopy number,
                           x_msg_data out nocopy varchar2)
is
l_api_name constant varchar2(30) := 'delete_activities';
Line: 4134

    select LTRIM(l_child_string, '1234567890') into str from dual;
Line: 4139

    select SUBSTR(l_child_string, 1, diff) into childstr from dual;
Line: 4141

    delete from amw_latest_hierarchies where parent_id = p_parent_process_id
    and child_id = l_child_id and organization_id = -1;
Line: 4143

    select LTRIM(str, 'x') into l_child_string from dual;
Line: 4165

end delete_activities;
Line: 4210

    select LTRIM(l_child_string, '1234567890') into str from dual;
Line: 4215

    select SUBSTR(l_child_string, 1, diff) into childstr from dual;
Line: 4237

	--update the latest hierarchy table
    insert into amw_latest_hierarchies(ORGANIZATION_ID,
                                   PARENT_ID,
                                   CHILD_ID,
                                   CHILD_ORDER_NUMBER,
                                   LAST_UPDATE_DATE,
                                   LAST_UPDATED_BY,
                                   LAST_UPDATE_LOGIN,
                                   CREATION_DATE,
                                   CREATED_BY,
                                   OBJECT_VERSION_NUMBER
                                   )
         VALUES                   (-1,
                                   p_parent_process_id,
                                   l_child_id,
                                   AMW_CHILD_ORDER_S.nextval,
                                   p_sysdate,
                                   g_user_id,
                                   g_login_id,
                                   p_sysdate,
                                   g_user_id,
                                   1)
         returning                CHILD_ORDER_NUMBER
         into                     l_child_order_number;
Line: 4263

  	update_appr_ch_ord_num_if_reqd(-1, p_parent_process_id, l_child_id,
                                 l_child_order_number);
Line: 4267

    select LTRIM(str, 'x') into l_child_string from dual;
Line: 4345

PROCEDURE update_latest_denorm_counts
( p_process_id		    IN NUMBER,
  p_commit		           IN VARCHAR2 := FND_API.G_FALSE,
  p_validation_level		   IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
  p_init_msg_list		   IN VARCHAR2 := FND_API.G_FALSE,
  x_return_status		   OUT NOCOPY VARCHAR2,
  x_msg_count			   OUT NOCOPY VARCHAR2,
  x_msg_data			   OUT NOCOPY VARCHAR2)
IS

  L_API_NAME CONSTANT VARCHAR2(30) := 'update_latest_denorm_counts';
Line: 4373

	AMW_RL_HIERARCHY_PKG.update_denorm(p_org_id => -1);
Line: 4375

    update_latest_risk_counts(p_process_id => p_process_id);
Line: 4377

    update_latest_control_counts( p_process_id => p_process_id);
Line: 4399

END update_latest_denorm_counts;