DBA Data[Home] [Help]

APPS.AML_MONITOR_WF SQL Statements

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

Line: 84

    SELECT hzl.country, asl.lead_rank_id, asl.creation_date
    FROM  as_sales_leads asl,
          hz_party_sites hzp,
          hz_locations hzl
    WHERE hzl.location_id = hzp.location_id
    AND   hzp.party_site_id = asl.address_id
    AND   asl.sales_lead_id = c_sales_lead_id;
Line: 95

SELECT rule.process_rule_id,  rule.monitor_condition_id, rule.time_lag_num
	   FROM  (
	            -- ------------------------------------------------------------
	            -- Country
	            -- ------------------------------------------------------------
    	           SELECT DISTINCT a.process_rule_id, d.monitor_condition_id, d.time_lag_num
        	         FROM   pv_process_rules_b a,
	                        pv_enty_select_criteria b,
	                        pv_selected_attr_values c,
                            AML_monitor_conditions d
	                 WHERE  b.selection_type_code = 'MONITOR_SCOPE'
	                 AND    b.attribute_id        = pv_check_match_pub.g_a_Country_
	                 AND    a.process_type        = 'LEAD_MONITOR'
	                 AND    a.process_rule_id     = b.process_rule_id
	                 AND    b.selection_criteria_id = c.selection_criteria_id(+)
	                 AND   (b.operator = 'EQUALS' AND c.attribute_value = c_country)
	                 AND a.process_rule_id = d.process_rule_id
                     AND a.status_code = 'ACTIVE'
                     AND d.time_lag_from_stage = c_from_stage_changed
	-- ------------------------------------------------------------
	-- Lead Rating
	-- ------------------------------------------------------------
         --   INTERSECT
	 UNION ALL
	                 SELECT DISTINCT a.process_rule_id, d.monitor_condition_id, d.time_lag_num
	                 FROM   pv_process_rules_b a,
	                        pv_enty_select_criteria b,
	                        pv_selected_attr_values c,
                            AML_monitor_conditions d
	                 WHERE  b.selection_type_code = 'MONITOR_SCOPE'
	                 AND    b.attribute_id =pv_check_match_pub.g_a_Lead_Rating
	                 AND    a.process_type        = 'LEAD_MONITOR'
	                 AND    a.process_rule_id     = b.process_rule_id
	                 AND    b.selection_criteria_id = c.selection_criteria_id(+)
	                 AND  (b.operator = 'EQUALS' AND c.attribute_value =  c_lead_rank )
	                 AND a.process_rule_id = d.process_rule_id
                     AND a.status_code = 'ACTIVE'
                     AND d.time_lag_from_stage = c_from_stage_changed
                 ) rule
GROUP BY rule.process_rule_id, rule.monitor_condition_id,rule.time_lag_num
      HAVING (rule.process_rule_id, COUNT(*)) IN (
         SELECT a.process_rule_id, COUNT(*)
	 FROM   pv_process_rules_b a,
                pv_enty_select_criteria b
         WHERE  a.process_rule_id     = b.process_rule_id AND
                b.selection_type_code = 'MONITOR_SCOPE' AND
                a.status_code         = 'ACTIVE' AND
                a.process_type        = 'LEAD_MONITOR' AND
                SYSDATE >= a.start_date AND SYSDATE <= a.end_date
         GROUP  BY a.process_rule_id)
ORDER BY COUNT(*) DESC,
rule.time_lag_num ASC;
Line: 150

          SELECT item_key
          FROM   wf_items
          WHERE  item_type= c_item_type
          AND    item_key like c_item_key_like
          AND    end_date is null
          ORDER BY item_key desc;
Line: 159

   select item_key
   from wf_items
   where item_type= c_itemtype
   AND    item_key like c_itemkey_like
   ORDER BY to_number (substr(item_key,(instr(item_key,'_')+1) ) ) desc;
Line: 166

      SELECT text_value from wf_item_attribute_values
       WHERE item_type = c_item_type
         AND item_key like c_item_key
         AND name = 'TIMELAG_FROM_STAGE'
        -- swkhanna 9/8/03
        -- AND text_value = 'CREATION_DATE'
     ORDER BY item_key desc;
Line: 177

      SELECT number_value from wf_item_attribute_values
       WHERE item_type = c_item_type
         AND item_key = c_item_key
         AND name = c_attr_name
     ORDER BY item_key desc;
Line: 247

        elsif p_lead_action = 'UPDATE' then
           l_new_lead := 'N';
Line: 474

 /*     SELECT TO_CHAR(AS_WORKFLOW_KEYS_S.nextval) INTO itemkey  */
/*      FROM dual;  */
Line: 485

       select p_sales_lead_id||'_'||'1' into itemkey from dual;
Line: 487

       select p_sales_lead_id || '_' || (substr(l_existing_itemkey,(instr(l_existing_itemkey,'_')+1) ) + 1 ) into itemkey
       from dual ;
Line: 542

       select to_date(to_char(sysdate,'MM/DD/YYYY HH:MI:SS AM'),'MM/DD/YYYY HH:MI:SS AM')
       into l_monitor_launch_date from dual;
Line: 683

  l_last_update_date      DATE;
Line: 735

   SELECT  DISTINCT d.monitor_type_code,d.object_version_number,
                    d.time_lag_from_stage, d.time_lag_to_stage,
                    d.time_lag_num, d.time_lag_uom_code,
                    d.expiration_relative, d.Reminder_defined, d.total_reminders,
                    d.reminder_frequency,d.timeout_defined, d.timeout_duration,
                    d.timeout_uom_code, d.notify_owner, d.notify_owner_manager
   FROM   AML_monitor_conditions d
   WHERE  d.monitor_condition_id = c_monitor_condition_id;
Line: 746

    SELECT creation_date, last_update_date, lead_number, status_code,
    assign_date, accept_flag, lead_rank_id, expiration_date,
    assign_to_salesforce_id, assign_sales_group_id, current_reroutes, description,
    customer_id
    FROM   as_sales_leads
    WHERE  sales_lead_id = c_sales_lead_id;
Line: 754

    SELECT  usr.user_name
    FROM    as_sales_leads lead, fnd_user usr
    WHERE   lead.sales_lead_id = c_lead_id
    and     lead.assign_to_person_id =  usr.employee_id;
Line: 761

select source_first_name || ' '||source_last_name
from jtf_rs_resource_extns
where resource_id = c_assign_to_salesforce_id;
Line: 768

/*      SELECT  usr.user_name  */
/*      FROM   pv_process_rules_b rule, fnd_user usr, jtf_rs_resource_extns res  */
/*      WHERE  rule.process_rule_id = c_process_rule_id  */
/*      AND    rule.owner_resource_id = res.resource_id  */
/*      and     res.user_id = usr.user_id;       */
Line: 775

          select usr.user_name, res.resource_id
             from jtf_rs_rep_managers mgr, fnd_user usr, jtf_rs_resource_extns res
            where mgr.manager_person_id = res.source_id
             and res.user_id = usr.user_id
             and mgr.resource_id= c_resource_id
             and mgr.group_id = c_group_id
             and mgr.start_date_active <= SYSDATE
             and (mgr.end_date_active IS NULL OR mgr.end_date_active >= SYSDATE)
             and mgr.reports_to_flag = 'Y';
Line: 786

	     select meaning
	     from as_lookups
	     where lookup_type = c_lookup_type
	     and   lookup_code = c_lookup_code;
Line: 792

	     select meaning
	     from as_statuses_vl
	     where status_code = c_status_code;
Line: 797

             select party_name
             from hz_parties
             where party_id = c_customer_id;
Line: 813

       select to_date(to_char(sysdate,'MM/DD/YYYY HH:MI:SS AM'),'MM/DD/YYYY HH:MI:SS AM')
       into l_monitor_launch_date from dual;
Line: 841

       fetch c_get_lead_details into l_creation_date, l_last_update_date, l_lead_number, l_status_code, l_assign_date,
                                      l_accept_flag, l_lead_rank_id , l_expiration_date,
                                      l_resource_id, l_group_id , l_current_reroutes, l_description,l_customer_id;
Line: 862

                                  aname    => 'LEAD_UPDATED_DATE',
                                  avalue   => l_last_update_date);
Line: 1572

SELECT aml_MONITOR_LOG_S.nextval into l_monitor_log_id FROM sys.dual;
Line: 1575

   INSERT INTO aml_MONITOR_LOG(
           MONITOR_LOG_ID
          ,LAST_UPDATE_DATE
          ,LAST_UPDATED_BY
          ,CREATION_DATE
          ,CREATED_BY
          ,LAST_UPDATE_LOGIN
          ,OBJECT_VERSION_NUMBER
          ,REQUEST_ID
          ,PROGRAM_APPLICATION_ID
          ,PROGRAM_ID
          ,PROGRAM_UPDATE_DATE
          ,MONITOR_CONDITION_ID
          ,RECIPIENT_ROLE
          ,MONITOR_ACTION
          ,RECIPIENT_RESOURCE_ID
          ,SALES_LEAD_ID
          ) VALUES (
           l_monitor_log_id
          ,sysdate
          ,fnd_global.user_id
          ,sysdate
          ,fnd_global.user_id
          ,fnd_global.user_id
          ,1
          ,null
          ,null
          ,null
          ,null
          ,l_monitor_condition_id
          ,'OWNER'
          ,l_monitor_action
          ,l_lead_owner_resource_id
          ,l_sales_lead_id
);
Line: 1982

                update as_sales_leads
                set current_reroutes = l_current_reroutes
                where sales_lead_id = l_sales_lead_id;
Line: 2146

    select source_id, source_name, source_email, user_name
    from  jtf_rs_resource_extns
    where resource_id = c_esc_mgr_resource_id;
Line: 2238

     l_curr_last_update_date date;
Line: 2239

     l_orig_last_update_date date;
Line: 2245

         select 'Y'
         from as_statuses_b
         where lead_flag = 'Y'
         and status_code = c_status_code;
Line: 2251

     select status_code
     from as_sales_leads
     where sales_lead_id = c_sales_lead_id;
Line: 2256

      select 'Y'
      from as_lookups
      where lookup_type = 'TIME_LAG_TO_STAGE'
      and   lookup_code = c_lookup_code;
Line: 2262

    select accept_flag
    from as_sales_leads
    where sales_lead_id = c_sales_lead_id;
Line: 2308

          SELECT nvl(opp_open_status_flag, 'Y')
          INTO l_opp_open_status_flag
          FROM as_statuses_b
          WHERE status_code = l_lead_current_status;
Line: 2341

                 elsif l_timelag_to_stage = 'LAST_UPDATE_DATE' then
                    -- chk to see if lead has been updated since the workflow started
                    l_orig_last_update_date :=  wf_engine.GetItemAttrDate(
                                                       itemtype => itemtype,
                                                       itemkey  => itemkey,
                                                       aname    => 'LEAD_UPDATED_DATE');
Line: 2349

                    select last_update_date
                    into l_curr_last_update_date
                    from as_sales_leads
                    where sales_lead_id = l_sales_lead_id;
Line: 2356

                    if l_orig_last_update_date < l_curr_last_update_date then
                       l_condition_true := 'N';
Line: 2371

                         SELECT nvl(opp_open_status_flag, 'Y')
                         INTO l_opp_open_status_flag
                         FROM as_statuses_b
                         WHERE status_code = l_lead_current_status;
Line: 2469

                 elsif l_timelag_to_stage = 'LAST_UPDATE_DATE' then
                    -- chk to see if lead has been updated since the workflow started
                    l_orig_last_update_date :=  wf_engine.GetItemAttrText(
                                                       itemtype => itemtype,
                                                       itemkey  => itemkey,
                                                       aname    => 'LEAD_UPDATED_DATE');
Line: 2477

                    select last_update_date
                    into l_curr_last_update_date
                    from as_sales_leads
                    where sales_lead_id = l_sales_lead_id;
Line: 2482

                    if l_orig_last_update_date = l_curr_last_update_date then
                       l_condition_true := 'Y';
Line: 2488

                 end if; -- last_update_date
Line: 2565

      SELECT res.resource_id
      FROM jtf_rs_resource_extns res
      WHERE res.category = 'EMPLOYEE'
      AND res.user_id = fnd_global.user_id;
Line: 2571

      SELECT grp.group_id
      FROM JTF_RS_GROUP_MEMBERS mem,
           JTF_RS_ROLE_RELATIONS rrel,
           JTF_RS_ROLES_B role,
           JTF_RS_GROUP_USAGES u,
           JTF_RS_GROUPS_B grp
      WHERE mem.group_member_id = rrel.role_resource_id
      AND rrel.role_resource_type = 'RS_GROUP_MEMBER'
      AND rrel.role_id = role.role_id
      AND role.role_type_code IN ('SALES','TELESALES','FIELDSALES','PRM')
      AND mem.delete_flag <> 'Y'
      AND rrel.delete_flag <> 'Y'
      AND SYSDATE BETWEEN rrel.start_date_active AND
          NVL(rrel.end_date_active,SYSDATE)
      AND mem.resource_id = c_resource_id
      AND mem.group_id = u.group_id
      AND u.usage = 'SALES'
      AND mem.group_id = grp.group_id
      AND SYSDATE BETWEEN grp.start_date_active AND
          NVL(grp.end_date_active,SYSDATE)
      AND ROWNUM < 2;
Line: 2597

      SELECT res.source_id
      FROM jtf_rs_resource_extns res
      WHERE res.resource_id = c_resource_id;
Line: 2812

    SELECT hzl.country, asl.lead_rank_id
    FROM  as_sales_leads asl,
          hz_party_sites hzp,
          hz_locations hzl
    WHERE hzl.location_id = hzp.location_id
    AND   hzp.party_site_id = asl.address_id
    AND   asl.sales_lead_id = c_sales_lead_id;
Line: 2823

SELECT rule.process_rule_id,  rule.monitor_condition_id, rule.time_lag_num
	   FROM  (
	            -- ------------------------------------------------------------
	            -- Country
	            -- ------------------------------------------------------------
    	           SELECT DISTINCT a.process_rule_id, d.monitor_condition_id, d.time_lag_num
        	         FROM   pv_process_rules_b a,
	                        pv_enty_select_criteria b,
	                        pv_selected_attr_values c,
                            AML_monitor_conditions d
	                 WHERE  b.selection_type_code = 'MONITOR_SCOPE'
	                 AND    b.attribute_id        = pv_check_match_pub.g_a_Country_
	                 AND    a.process_type        = 'LEAD_MONITOR'
	                 AND    a.process_rule_id     = b.process_rule_id
	                 AND    b.selection_criteria_id = c.selection_criteria_id(+)
	                 AND   (b.operator = 'EQUALS' AND c.attribute_value = c_country)
	                 AND a.process_rule_id = d.process_rule_id
                     AND a.status_code = 'ACTIVE'
                     AND d.time_lag_from_stage = c_from_stage_changed
	-- ------------------------------------------------------------
	-- Lead Rating
	-- ------------------------------------------------------------
                   INTERSECT
	                 SELECT DISTINCT a.process_rule_id, d.monitor_condition_id, d.time_lag_num
	                 FROM   pv_process_rules_b a,
	                        pv_enty_select_criteria b,
	                        pv_selected_attr_values c,
                            AML_monitor_conditions d
	                 WHERE  b.selection_type_code = 'MONITOR_SCOPE'
	                 AND    b.attribute_id =pv_check_match_pub.g_a_Lead_Rating
	                 AND    a.process_type        = 'LEAD_MONITOR'
	                 AND    a.process_rule_id     = b.process_rule_id
	                 AND    b.selection_criteria_id = c.selection_criteria_id(+)
	                 AND  (b.operator = 'EQUALS' AND c.attribute_value =  c_lead_rank )
	                 AND a.process_rule_id = d.process_rule_id
                     AND a.status_code = 'ACTIVE'
                     AND d.time_lag_from_stage = c_from_stage_changed
                 ) rule
GROUP BY rule.process_rule_id, rule.monitor_condition_id,rule.time_lag_num
      HAVING (rule.process_rule_id) IN (
         SELECT a.process_rule_id
         FROM   pv_process_rules_b a,
                pv_enty_select_criteria b
         WHERE  a.process_rule_id     = b.process_rule_id AND
                b.selection_type_code = 'MONITOR_SCOPE' AND
                a.status_code         = 'ACTIVE' AND
                a.process_type        = 'LEAD_MONITOR' AND
                SYSDATE >= a.start_date AND SYSDATE <= a.end_date
         GROUP  BY a.process_rule_id)
ORDER BY  rule.time_lag_num ASC;
Line: 2962

       select to_date(to_char(sysdate,'MM/DD/YYYY HH:MI:SS AM'),'MM/DD/YYYY HH:MI:SS AM')
       into l_monitor_launch_date from dual;
Line: 3032

   select timezone_id
   into l_GMT_timezone_id
   from hz_timezones_vl
   where name = 'GMT';
Line: 3128

  /*    update pv_lead_workflows set matched_due_date = l_matched_due_date,
             object_version_number = object_version_number + 1
      where wf_item_type = p_itemtype
      and   wf_item_key  = p_itemkey;*/
Line: 3211

    SELECT assign_date, assign_to_salesforce_id, assign_sales_group_id, assign_to_person_id
    FROM   as_sales_leads
    WHERE  sales_lead_id = c_sales_lead_id;
Line: 3216

    SELECT  usr.user_name
    FROM    as_sales_leads lead, fnd_user usr
    WHERE   lead.sales_lead_id = c_lead_id
    and     lead.assign_to_person_id =  usr.employee_id;
Line: 3223

select source_first_name || ' '||source_last_name
from jtf_rs_resource_extns
where resource_id = c_assign_to_salesforce_id;
Line: 3228

          select usr.user_name, res.resource_id
             from jtf_rs_rep_managers mgr, fnd_user usr, jtf_rs_resource_extns res
            where mgr.manager_person_id = res.source_id
             and res.user_id = usr.user_id
             and mgr.resource_id= c_resource_id
             and mgr.group_id = c_group_id
             and mgr.start_date_active <= SYSDATE
             and (mgr.end_date_active IS NULL OR mgr.end_date_active >= SYSDATE)
             and mgr.reports_to_flag = 'Y';
Line: 3242

   select source_id, source_name, source_email, user_name
   from  jtf_rs_resource_extns
   where resource_id = c_resource_id;
Line: 3398

                select  instr(l_notify_role_list, l_manager_username) into l_number from dual;
Line: 3431

                  select  instr(l_notify_role_list, l_mgr_name) into l_number from dual;