DBA Data[Home] [Help]

APPS.AHL_PRD_NONROUTINE_PVT SQL Statements

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

Line: 53

  PROCEDURE Update_sr(
    p_x_sr_task_rec  IN OUT  NOCOPY AHL_PRD_NONROUTINE_PVT.sr_task_rec_type,
    x_return_status  OUT     NOCOPY    VARCHAR2
  );
Line: 149

    SELECT incident_status_id FROM
    cs_incident_statuses
    WHERE status_code = 'PLANNED'
    AND incident_subtype = 'INC'
    AND trunc(sysdate) between trunc(nvl(start_date_active,sysdate))
    AND trunc(nvl(end_date_active,sysdate));
Line: 161

SELECT object_version_number
FROM CS_INCIDENTS
WHERE incident_id = p_incident_id;
Line: 170

  SELECT
  wo.workorder_id,
  wo.status_code
  FROM
  ahl_visit_tasks_b vtsk,
  ahl_workorders wo,
  ahl_unit_effectivities_b ue
  WHERE
  ue.cs_incident_id = p_incident_id
  AND ue.unit_effectivity_id = vtsk.unit_effectivity_id
  AND vtsk.visit_task_id = wo.visit_task_id
  AND upper(vtsk.task_type_code) = 'SUMMARY';
Line: 258

        ELSIF upper(l_sr_task_rec.operation_type) = 'UPDATE' THEN

          l_sr_task_rec.urgency_id      := FND_API.G_MISS_NUM;
Line: 325

      ELSIF ( upper(l_sr_task_rec.operation_type) = 'UPDATE' ) THEN

        IF (G_DEBUG = 'Y') THEN
          AHL_DEBUG_PUB.debug('PROC : Calling the Update SR procedure');
Line: 334

	      Update_sr( p_x_sr_task_rec => l_sr_task_rec,
			   x_return_status => l_return_status);
Line: 342

	      --- If the mode is update , then check if the NR has a corresponding workorder created or not
	      -- and set the flags accordingly .

	      --1. Query if the NR has a workorder created !

	      OPEN c_does_wo_exist(l_sr_task_rec.Incident_id);
Line: 415

            upper(l_sr_task_rec.operation_type) = 'UPDATE'
            AND
            p_x_mr_asso_tbl.COUNT > 0
          )
       )
    THEN
	    Process_Mr(
	      p_x_task_tbl	=>	p_x_sr_task_tbl,
	      p_mr_assoc_tbl	=>	p_x_mr_asso_tbl,
	      p_module_type     =>      p_module_type,
	      x_return_status	=>	x_return_status,
	      x_msg_count	=>	x_msg_count,
	      x_msg_data	=>	x_msg_data
	    );
Line: 490

		 AHL_DEBUG_PUB.debug('PROC : Calling the Update SR procedure');
Line: 492

		-- Call Update Service Request procedure
	      Update_sr( p_x_sr_task_rec => l_sr_task_rec,
		       x_return_status => l_return_status);
Line: 631

    SELECT lookup_code FROM fnd_lookup_values_vl
    WHERE lookup_type = 'REQUEST_PROBLEM_CODE'
    AND  enabled_flag = 'Y'
    AND trunc(sysdate) between trunc(nvl(start_date_active,sysdate))
    AND trunc(nvl(end_date_active,sysdate))
    AND upper(meaning) = upper(p_meaning);
Line: 639

    SELECT lookup_code FROM fnd_lookup_values_vl
    WHERE lookup_type = 'REQUEST_RESOLUTION_CODE'
    AND  enabled_flag = 'Y'
    AND trunc(sysdate) between trunc(nvl(start_date_active,sysdate))
    AND trunc(nvl(end_date_active,sysdate))
    AND upper(meaning) = upper(p_meaning);
Line: 647

    SELECT instance_id FROM csi_item_instances
    WHERE instance_number = p_instance_number;
Line: 651

    SELECT visit_id FROM ahl_visits_b
    WHERE visit_number = p_visit_number;
Line: 656

     SELECT OWNER_PARTY_ID
     FROM csi_item_instances
     WHERE instance_number = p_instance_number;
Line: 679

          Select party_name
          into
            l_customer_name
          from hz_parties
          where party_id
                = p_x_sr_task_rec.customer_id;
Line: 715

          Select party_id
          into
             l_customer_id
          from hz_parties
          where party_name = p_x_sr_task_rec.customer_name;
Line: 761

          Select party_name
          into
            l_contact_name
          from hz_parties
          where party_id
                = p_x_sr_task_rec.contact_id;
Line: 798

          Select party_id
          into
             l_contact_id
          from hz_parties
          where party_name = p_x_sr_task_rec.contact_name;
Line: 846

          Select full_name
          into
            l_contact_name
          from per_people_f
          where person_id
                = p_x_sr_task_rec.contact_id
          and trunc(sysdate) between trunc(nvl(effective_start_date,sysdate))
          and trunc(nvl(effective_end_date,sysdate));
Line: 885

          Select person_id
          into
             l_contact_id
          from per_people_f
          where full_name = p_x_sr_task_rec.contact_name
          and trunc(sysdate) between trunc(nvl(effective_start_date,sysdate))
          and trunc(nvl(effective_end_date,sysdate));
Line: 997

  ELSIF ( upper(p_x_sr_task_rec.operation_type) = 'UPDATE') THEN


-- Derive the Contact id, if its null and contact type in
-- 'RELATIONSHIP' or 'PERSON'.
-- If contact id is not null derive the contact name and id
-- and check the contact name against the input value, if <>
-- return error msg. If only contact name is passed then
-- derive the contact id and name.

    IF (upper(p_x_sr_task_rec.contact_type) in ('PARTY_RELATIONSHIP','PERSON')) THEN

      IF( p_x_sr_task_rec.contact_id is not null and
          p_x_sr_task_rec.contact_id <> FND_API.G_MISS_NUM
          and ( p_x_sr_task_rec.contact_name is not null and
                p_x_sr_task_rec.contact_name <> FND_API.G_MISS_CHAR )) THEN
        BEGIN
          Select  party_name
          into
            l_contact_name
          from hz_parties
          where party_id
                = p_x_sr_task_rec.contact_id;
Line: 1051

          Select party_id
          into
             l_contact_id
          from hz_parties
          where party_name = p_x_sr_task_rec.contact_name;
Line: 1099

          Select  full_name
          into
            l_contact_name
          from per_people_f
          where person_id
                = p_x_sr_task_rec.contact_id
          and trunc(sysdate) between trunc(nvl(effective_start_date,sysdate))
          and trunc(nvl(effective_end_date,sysdate));
Line: 1137

          Select person_id
          into
             l_contact_id
          from per_people_f
          where full_name = p_x_sr_task_rec.contact_name
          and trunc(sysdate) between trunc(nvl(effective_start_date,sysdate))
          and trunc(nvl(effective_end_date,sysdate));
Line: 1274

    SELECT incident_status_id FROM
    cs_incident_statuses
    WHERE status_code = 'OPEN'
    AND incident_subtype = 'INC'
    AND trunc(sysdate) between trunc(nvl(start_date_active,sysdate))
    AND trunc(nvl(end_date_active,sysdate));
Line: 1283

    SELECT csv.incident_severity_id
    FROM cs_incident_severities_vl csv,
    mfg_lookups mfl
    WHERE csv.incident_severity_id = p_severity_id
    AND mfl.lookup_type = 'WIP_EAM_ACTIVITY_PRIORITY'
    AND trunc(sysdate) between trunc(nvl(csv.start_date_active,sysdate))
    AND trunc(nvl(csv.end_date_active,sysdate));
Line: 1292

    SELECT employee_id
    FROM fnd_user
    WHERE user_id = fnd_global.user_id;
Line: 1297

    SELECT party_type
    FROM hz_parties
    WHERE party_id = fnd_profile.value('AHL_PRD_SR_CUSTOMER_NAME');
Line: 1303

    SELECT OWNER_PARTY_ID
    FROM csi_item_instances
    WHERE instance_id = p_item_instance_number;
Line: 1308

    SELECT party_type
    FROM hz_parties
    WHERE party_id = p_cust_id;
Line: 1317

    SELECT 'X'
    FROM mtl_system_items_b mtl, csi_item_instances csi
    WHERE csi.instance_id = c_instance_id
    AND csi.inventory_item_id = mtl.inventory_item_id
    AND mtl.organization_id = (SELECT organization_id from wip_discrete_jobs wdj, ahl_workorders awo where wdj.wip_entity_id = awo.wip_entity_id and awo.workorder_id = c_workorder_id)
    AND mtl.serial_number_control_code = 1;
Line: 1325

    SELECT csi.quantity
    FROM    CSI_ITEM_INSTANCES csi,
            ahl_workorders wo
    WHERE   csi.instance_id = c_instance_id
        AND csi.wip_job_id  = WO.WIP_ENTITY_ID
        AND wo.workorder_id = c_wo_id
        AND csi.location_type_code = 'WIP'
        AND not exists (select 'x' from csi_ii_relationships
                        where subject_id = csi.instance_id
                        AND RELATIONSHIP_TYPE_CODE  = 'COMPONENT-OF'
                        AND TRUNC(NVL(ACTIVE_START_DATE, SYSDATE)) <= TRUNC(SYSDATE)
                        AND TRUNC(NVL(ACTIVE_END_DATE, SYSDATE+1))  > TRUNC(SYSDATE));
Line: 1529

         Select party_name
         into
         p_x_sr_task_rec.customer_name
          from hz_parties
          where party_id = p_x_sr_task_rec.customer_id;
Line: 1742

  ELSIF(upper(p_x_sr_task_rec.operation_type) = 'UPDATE') THEN


    -- bachandr added following validation for Bug # 6447467 (Base ER # 5571440)
    -- Bug # 6447467 -- start
    -- Check if resolution_meaning is not null. If resolution_meaning
    -- is null then return error message.

    IF ( nvl(fnd_profile.value('AHL_SR_RESL_CODE_COMP'), 'N') = 'Y') THEN

          IF ( p_x_sr_task_rec.resolution_meaning IS NULL OR
	       p_x_sr_task_rec.resolution_meaning = FND_API.G_MISS_CHAR) THEN

	         Fnd_Message.SET_NAME('AHL','AHL_PRD_RESL_CODE_REQ');
Line: 1905

  SELECT A.inventory_item_id,
         A.item_organization_id
  FROM   AHL_VISIT_TASKS_B A,
         AHL_WORKORDERS B
  WHERE  A.visit_task_id = B.visit_task_id
  AND    B.workorder_id = p_workorder_id;
Line: 1913

      SELECT INCIDENT_TYPE_ID,NAME
      FROM cs_incident_types_vl
      where INCIDENT_SUBTYPE = 'INC'
      AND CMRO_FLAG = 'Y'
      -- Check added by balaji for bug # 4146503.
      -- always has to pick up the SR type id from AHL default SR Type profile.
      AND incident_type_id=fnd_profile.value('AHL_PRD_SR_TYPE')
     AND trunc(sysdate) between trunc(nvl(start_date_active,sysdate))
     AND trunc(nvl(end_date_active,sysdate));
Line: 2028

    update ahl_unit_effectivities_b
    set unit_config_header_id = AHL_UTIL_UC_PKG.get_uc_header_id(p_x_sr_task_rec.instance_id)
    where unit_effectivity_id in
    (
        select unit_effectivity_id
        from ahl_unit_effectivities_b
        where object_type = 'SR' and cs_incident_id = p_x_sr_task_rec.incident_id
    );
Line: 2065

      UPDATE AHL_UNIT_EFFECTIVITIES_B
      SET ORIGINATING_WO_ID = p_x_sr_task_rec.Originating_wo_id
      WHERE CS_INCIDENT_ID = p_x_sr_task_rec.incident_id;
Line: 2107

	            SELECT
	              WO.visit_task_id
	            FROM
	   	      AHL_WORKORDERS WO
	   	    WHERE
	   	      WO.workorder_id = c_Nonroutine_wo_id;
Line: 2117

SELECT
 awo.workorder_id
FROM
 ahl_workorders awo,
 ahl_visit_tasks_b vtsk
WHERE
 awo.visit_task_id = vtsk.visit_task_id
 AND awo.master_workorder_flag = 'Y'
 AND vtsk.task_type_code = 'SUMMARY'
 AND vtsk.mr_id is NULL
 AND vtsk.unit_effectivity_id = p_unit_effectivity_id;
Line: 2132

  Select  unit_effectivity_id
  from AHL_UNIT_EFFECTIVITIES_B
  where cs_incident_id  = p_incident_id;
Line: 2138

SELECT object_version_number
FROM CS_INCIDENTS
WHERE incident_id = p_incident_id;
Line: 2146

    SELECT  workorder_id
    FROM    ahl_workorders
    WHERE   MASTER_WORKORDER_FLAG = 'N'
        AND wip_entity_id in
            (SELECT rel.child_object_id
            FROM    wip_sched_relationships rel START
            WITH REL.parent_object_id               = (SELECT wip_entity_id FROM ahl_workorders WHERE workorder_id = p_nr_wo_id)
                    CONNECT BY REL.parent_object_id = PRIOR REL.child_object_id
                AND REL.parent_object_type_id       = PRIOR REL.child_object_type_id
                AND REL.relationship_type           = 1
            )
    ORDER BY workorder_id;
Line: 2514

        Select name
        FROM cs_incident_types_vl
        WHERE incident_type_id = c_req_type_id;
Line: 2519

      Select visit_task_id
      from ahl_workorders
      where workorder_id = c_org_wo_id;
Line: 2525

  Select  unit_effectivity_id
  from AHL_UNIT_EFFECTIVITIES_B
  where cs_incident_id  = p_incident_id;
Line: 2787

PROCEDURE Update_sr(
  p_x_sr_task_rec  IN OUT NOCOPY AHL_PRD_NONROUTINE_PVT.sr_task_rec_type,
  x_return_status  OUT NOCOPY    VARCHAR2
) IS

  l_service_request_rec   CS_SERVICEREQUEST_PUB.service_request_rec_type;
Line: 2814

   l_service_request_rec.last_update_program_code := p_x_sr_task_rec.source_program_code;
Line: 2829

   CS_SERVICEREQUEST_PUB.Update_ServiceRequest(
     p_api_version            => 3.0,
     p_init_msg_list          => FND_API.G_TRUE,
     p_commit                 => FND_API.G_FALSE,
     x_return_status          => x_return_status,
     x_msg_count              => l_msg_count,
     x_msg_data               => l_msg_data,
     p_request_id             => p_x_sr_task_rec.incident_id,
     --p_request_number         => p_x_sr_task_rec.incident_number,
     p_audit_comments         => Null,
     p_object_version_number  => p_x_sr_task_rec.incident_object_version_number,
     p_resp_appl_id           => NULL,
     p_resp_id                => NULL,
     p_last_updated_by        => NULL,
     p_last_update_login      => NULL,
     p_last_update_date       => NULL,
     p_service_request_rec    => l_service_request_rec,
     p_notes                  => l_notes_table,
     p_contacts               => l_contacts_table,
     p_called_by_workflow     => NULL,
     p_workflow_process_id    => NULL,
     x_workflow_process_id    => p_x_sr_task_rec.workflow_process_id,
     x_interaction_id         => p_x_sr_task_rec.interaction_id
   );
Line: 2854

END Update_sr;
Line: 2866

    Select workorder_name
    from ahl_workorders
    where workorder_id = p_wo_id;
Line: 2871

    Select instance_number
    from csi_item_instances
    where instance_id = p_instance_id;
Line: 2904

    Select workorder_name
    from ahl_workorders
    where workorder_id = p_sr_task_rec.originating_wo_id;
Line: 2910

    Select ci.instance_number,
           ci.serial_number,
           msi.concatenated_segments
    from csi_item_instances ci,
         mtl_system_items_kfv msi
    where ci.instance_id = p_sr_task_rec.instance_id
    and   ci.inventory_item_id = msi.inventory_item_id
    and   ci.inv_master_organizatiOn_id = msi.organization_id;