DBA Data[Home] [Help]

APPS.GMD_API_GRP SQL Statements

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

Line: 133

         SELECT application_id
         FROM   fnd_application
         WHERE  application_short_name = 'GMD';
Line: 140

         SELECT context_column_name, context_required_flag
         FROM   fnd_descriptive_flexs
         WHERE  application_id = v_application_id AND
                descriptive_flexfield_name = v_flex_field_name;
Line: 149

         SELECT 1
         FROM   sys.DUAL
         WHERE  EXISTS ( SELECT 1
                         FROM   fnd_descr_flex_contexts
                         WHERE  application_id = v_application_id AND
                                descriptive_flexfield_name =
                                                            v_flex_field_name AND
                                descriptive_flex_context_code = v_field_value);
Line: 162

         SELECT required_flag, flex_value_set_id, display_flag
         FROM   fnd_descr_flex_column_usages
         WHERE  application_id = v_application_id AND
                descriptive_flexfield_name = v_flex_field_name AND
                application_column_name = v_field_name AND
                enabled_flag = 'Y';
Line: 170

         SELECT flex_value_set_name, format_type, maximum_size
               ,number_precision, alphanumeric_allowed_flag
               ,uppercase_only_flag, minimum_value, maximum_value
         FROM   fnd_flex_value_sets
         WHERE  flex_value_set_id = v_value_set_id;
Line: 374

        SELECT descriptive_flexfield_name, application_id
        FROM   fnd_descriptive_flexs
        WHERE  application_table_name = vTable_name;
Line: 379

        SELECT application_short_name
        FROM   fnd_application
        WHERE  application_id = vAppl_id;
Line: 387

      SELECT DECODE (
                p_field_name,
                'ATTRIBUTE_CATEGORY', p_flex_record.attribute_category,
                'ATTRIBUTE1', p_flex_record.attribute1,
                'ATTRIBUTE2', p_flex_record.attribute2,
                'ATTRIBUTE3', p_flex_record.attribute3,
                'ATTRIBUTE4', p_flex_record.attribute4,
                'ATTRIBUTE5', p_flex_record.attribute5,
                'ATTRIBUTE6', p_flex_record.attribute6,
                'ATTRIBUTE7', p_flex_record.attribute7,
                'ATTRIBUTE8', p_flex_record.attribute8,
                'ATTRIBUTE9', p_flex_record.attribute9,
                'ATTRIBUTE10', p_flex_record.attribute10,
                'ATTRIBUTE11', p_flex_record.attribute11,
                'ATTRIBUTE12', p_flex_record.attribute12,
                'ATTRIBUTE13', p_flex_record.attribute13,
                'ATTRIBUTE14', p_flex_record.attribute14,
                'ATTRIBUTE15', p_flex_record.attribute15,
                'ATTRIBUTE16', p_flex_record.attribute16,
                'ATTRIBUTE17', p_flex_record.attribute17,
                'ATTRIBUTE18', p_flex_record.attribute18,
                'ATTRIBUTE19', p_flex_record.attribute19,
                'ATTRIBUTE20', p_flex_record.attribute20,
                'ATTRIBUTE21', p_flex_record.attribute21,
                'ATTRIBUTE22', p_flex_record.attribute22,
                'ATTRIBUTE23', p_flex_record.attribute23,
                'ATTRIBUTE24', p_flex_record.attribute24,
                'ATTRIBUTE25', p_flex_record.attribute25,
                'ATTRIBUTE26', p_flex_record.attribute26,
                'ATTRIBUTE27', p_flex_record.attribute27,
                'ATTRIBUTE28', p_flex_record.attribute28,
                'ATTRIBUTE29', p_flex_record.attribute29,
                'ATTRIBUTE30', p_flex_record.attribute30
             )
      INTO l_field_value
      FROM sys.DUAL;
Line: 597

        SELECT    b.organization_code, b.organization_id
        INTO      l_owner_orgn_code, l_orgn_id
        FROM      fm_form_mst_b a, mtl_parameters b
        WHERE     a.formula_id = Entity_id
	          AND a.owner_organization_id = b.organization_id;
Line: 605

          FND_MESSAGE.SET_NAME('GMD','GMD_FORMULA_NOT_UPDATEABLE');
Line: 613

        SELECT    b.organization_code, b.organization_id
        INTO      l_owner_orgn_code, l_orgn_id
        FROM      gmd_recipes_b a, mtl_parameters b
        WHERE     recipe_id = Entity_id
	          AND a.owner_organization_id = b.organization_id;
Line: 621

          FND_MESSAGE.SET_NAME('GMD','GMD_RECIPE_NOT_UPDATEABLE');
Line: 629

    SELECT  c.organization_code , a.owner_organization_id
    INTO      l_owner_orgn_code, l_orgn_id
    FROM gmd_recipes a , gmd_recipe_validity_rules b , mtl_parameters c
    WHERE b.recipe_validity_rule_id = Entity_id
    AND a.recipe_id = b.recipe_id
    AND a.owner_organization_id = c.organization_id ;
Line: 640

	  FND_MESSAGE.SET_NAME('GMD','GMD_RECIPE_NOT_UPDATEABLE');
Line: 651

        SELECT    b.organization_code, b.organization_id
        INTO      l_Owner_orgn_code, l_orgn_id
        FROM      gmd_routings_b a, mtl_parameters b
         WHERE    a.routing_id = Entity_id
	          AND a.owner_organization_id = b.organization_id;
Line: 659

          FND_MESSAGE.SET_NAME('GMD','GMD_ROUTING_NOT_UPDATEABLE');
Line: 666

        SELECT    b.organization_code, b.organization_id
          INTO    l_Owner_orgn_code, l_orgn_id
          FROM    gmd_operations_b a, mtl_parameters b
         WHERE    a.oprn_id = Entity_id
	   AND    a.owner_organization_id = b.organization_id;
Line: 674

          FND_MESSAGE.SET_NAME('GMD','GMD_OPERATION_NOT_UPDATEABLE');
Line: 708

      SELECT 1
      FROM   SYS.DUAL
      WHERE  EXISTS (SELECT 1
                     from org_access_view a, mtl_parameters b
                     where a.organization_id = b.organization_id
                       and b.organization_id = powner_orgn_id
                       and a.responsibility_id = l_responsibility_id --Bug 14000659
                       and b.process_enabled_flag = 'Y');
Line: 718

        SELECT organization_code
        FROM   mtl_parameters
        WHERE  organization_id = V_organization_id;
Line: 728

      Update_not_allowed_exp   EXCEPTION;
Line: 735

          RAISE Update_not_allowed_exp;
Line: 742

      WHEN Update_not_allowed_exp THEN
        /*Bug 4716697 - Thomas Daniel */
        /*Added code to fetch the organization code to set the message*/
        OPEN Cur_get_orgn (powner_orgn_id);
Line: 748

        FND_MESSAGE.SET_NAME('GMD', 'GMD_USER_ORG_NOT_UPDATE');
Line: 773

        SELECT s.status_type
        FROM   fm_form_mst_b f,gmd_Status_b s
        WHERE  f.formula_id = pobject_id AND
               f.formula_status = s.status_code;
Line: 779

        SELECT s.status_type
        FROM   gmd_recipes_b r,gmd_Status_b s
        WHERE  r.recipe_id = pobject_id AND
               r.recipe_status = s.status_code;
Line: 785

        SELECT s.status_type
        FROM  gmd_operations_b o,gmd_Status_b s
        WHERE o.oprn_id = pobject_id AND
              o.operation_status = s.status_code;
Line: 791

        SELECT s.status_type
        FROM  gmd_routings_b r,gmd_Status_b s
        WHERE r.routing_id = pobject_id AND
              r.routing_status = s.status_code;
Line: 797

        SELECT s.status_type
        FROM  gmd_recipe_validity_rules v,gmd_Status_b s
        WHERE v.recipe_validity_rule_id = pobject_id AND
              v.validity_rule_status = s.status_code;
Line: 844

        SELECT recipe_status
         FROM  gmd_recipes
        WHERE  recipe_id = entity_id
             AND ((recipe_status between 700 and 799
                   OR recipe_status between 400 and 499));
Line: 852

        SELECT formula_status
         FROM  fm_form_mst
        WHERE  formula_id = entity_id
             AND ((formula_status between 700 and 799
                   OR formula_status between 400 and 499));
Line: 859

        SELECT routing_status
         FROM  fm_rout_hdr
        WHERE  routing_id = entity_id
           AND ((routing_status between 700 and 799
                OR routing_status between 400 and 499));
Line: 866

        SELECT operation_status
         FROM  gmd_operations
        WHERE  oprn_id = entity_id
             AND ((operation_status between 700 and 799
                  OR operation_status between 400 and 499));
Line: 962

          Select formula_no, formula_vers, formula_no||' - '||formula_vers
          INTO   l_object_name, l_object_version, l_object_name_and_version
          FROM   fm_form_mst_b
          WHere  formula_id = vEntity_id;
Line: 967

          Select routing_no, routing_vers, routing_no||' - '||routing_vers
          INTO   l_object_name, l_object_version, l_object_name_and_version
          FROM   gmd_routings_b
          WHere  routing_id = vEntity_id;
Line: 972

          Select oprn_no, oprn_vers, oprn_no||' - '||oprn_vers
          INTO   l_object_name, l_object_version, l_object_name_and_version
          FROM   gmd_operations_b
          WHere  oprn_id = vEntity_id;
Line: 977

          Select recipe_no, recipe_version, recipe_no||' - '||recipe_version
          INTO   l_object_name, l_object_version, l_object_name_and_version
          FROM   gmd_recipes_b
          WHere  recipe_id = vEntity_id;
Line: 982

          Select r.recipe_no, r.recipe_version, r.recipe_no||' - '||r.recipe_version
          INTO   l_object_name, l_object_version, l_object_name_and_version
          FROM   gmd_recipes_b r, gmd_recipe_validity_rules v
          WHere  v.recipe_id = vEntity_id
          AND    v.recipe_id = r.recipe_id;
Line: 1020

      SELECT active_formula_ind
      FROM gmd_vpd_security;
Line: 1024

      SELECT 1
      FROM   sys.dual
      WHERE EXISTS ( SELECT 1
                     FROM gmd_security_profiles sp
                     WHERE sp.access_type_ind = 'U'
                     AND nvl(responsibility_id, fnd_global.resp_id) = fnd_global.resp_id /* Bug No.9077438 */
                     AND ( responsibility_id IN ( SELECT rg.responsibility_id
                                                  FROM FND_USER_RESP_GROUPS rg
                                                  WHERE rg.user_id = fnd_global.user_id
                                                  AND SYSDATE BETWEEN rg.start_date
                                                  AND NVL(rg.end_date, SYSDATE)
                                                 )
                           OR ( sp.user_id = V_default_user_id
                                OR sp.user_id = fnd_global.user_id
                               )
                          )
                     AND organization_id = P_owner_organization_id
                     AND (other_organization_id IS NULL
                          OR EXISTS ( SELECT NULL
                                      FROM org_access a3
                                      WHERE a3.organization_id = sp.other_organization_id
                                      AND NVL(a3.disable_date, SYSDATE+1) >= SYSDATE
                                      AND a3.resp_application_id = fnd_global.resp_appl_id
                                      AND a3.responsibility_id = fnd_global.resp_id
                                     )
                          OR NOT EXISTS ( SELECT NULL
                                          FROM org_access a4
                                          WHERE a4.organization_id = sp.other_organization_id
                                          AND NVL(a4.disable_date, SYSDATE+1) >=SYSDATE
                                         )
                          )
                    );
Line: 1059

      SELECT sp.access_type_ind
      FROM gmd_security_profiles sp
      WHERE sp.assign_method_ind = 'A'
       AND NVL(responsibility_id, fnd_global.resp_id) = fnd_global.resp_id  /* Bug No.9077438 */
      AND (  ( sp.user_id =  V_default_user_id
               OR  sp.user_id = fnd_global.user_id
              )
             OR ( EXISTS ( SELECT rg.responsibility_id
                           FROM FND_USER_RESP_GROUPS rg
                           WHERE rg.user_id = fnd_global.user_id
                           AND sp.responsibility_id = rg.responsibility_id
                           AND SYSDATE BETWEEN rg.start_date AND NVL(rg.end_date, SYSDATE)
                          )
                 )
           )
      AND (  EXISTS ( SELECT NULL
                      FROM org_access a1
                      WHERE ( ( sp.organization_id = a1.organization_id
                                AND sp.other_organization_id IS NULL
                               )
                               OR sp.other_organization_id = a1.organization_id
                             )
                      AND NVL(a1.disable_date, SYSDATE+1) >= SYSDATE
                      AND a1.resp_application_id = fnd_global.resp_appl_id
                      AND a1.responsibility_id = fnd_global.resp_id
                     )
             OR
             NOT EXISTS ( SELECT NULL
                          FROM org_access a2
                          WHERE ( ( sp.organization_id = a2.organization_id
                                    AND sp.other_organization_id IS NULL
                                   )
                                  OR sp.other_organization_id = a2.organization_id
                                 )
                          AND NVL(a2.disable_date, SYSDATE+1) >=SYSDATE
                         )
           )
     AND sp.organization_id = P_owner_organization_id
     UNION
     SELECT fs.access_type_ind
     FROM   gmd_formula_security fs
     WHERE ( ( fs.user_id =  V_default_user_id
               OR  fs.user_id = fnd_global.user_id
              )
             OR ( EXISTS ( SELECT rg.responsibility_id
                           FROM FND_USER_RESP_GROUPS rg
                           WHERE rg.user_id = fnd_global.user_id
                           AND fs.responsibility_id = rg.responsibility_id
                           AND SYSDATE BETWEEN rg.start_date
                           AND NVL(rg.end_date, SYSDATE)
                          )
                 )
            )
     AND nvl(responsibility_id,fnd_global.resp_id) = fnd_global.resp_id /* Bug No.9077438 */
     AND   (EXISTS ( SELECT NULL
                     FROM org_access ou
                     WHERE ( ( fs.organization_id = ou.organization_id
                               AND fs.other_organization_id IS NULL
                              )
                              OR fs.other_organization_id = ou.organization_id
                            )
                     AND NVL(ou.disable_date, SYSDATE+1) >= SYSDATE
                     AND ou.resp_application_id = fnd_global.resp_appl_id
                     AND ou.responsibility_id = fnd_global.resp_id
                    )
            OR
            NOT EXISTS ( SELECT NULL
                         FROM org_access ou1
                         WHERE ( ( ou1.organization_id = fs.organization_id
                                   AND fs.other_organization_id IS NULL
                                  )
                                  OR ou1.organization_id = fs.other_organization_id
                                )
                         AND   NVL(ou1.disable_date, SYSDATE+1) >=SYSDATE
                        )
            )
     AND fs.formula_id = P_formula_id;
Line: 1194

    SELECT description
    FROM gmd_status
    WHERE status_code = V_entity_status;
Line: 1227

        SELECT st.status_code
              ,st.description
              ,st.status_type
        FROM   gmd_parameters_hdr h
              ,gmd_parameters_dtl d
              ,gmd_status st
        WHERE (h.organization_id = cp_orgn_id OR h.organization_id IS NULL)
        AND    h.parameter_id = d.parameter_id
        AND    d.parameter_name = cp_parameter_name
        AND    st.status_code = parameter_value
        ORDER BY h.organization_id;
Line: 1241

       SELECT b.status_code, b.description,b.status_type
       FROM   gmd_status b
       WHERE  b.status_code = 100;
Line: 1299

       SELECT operation_status
       FROM   gmd_operations
       WHERE  oprn_id = V_entity_id
       AND    operation_status >= V_entity_status;
Line: 1304

       SELECT formula_status FROM  fm_form_mst
       WHERE formula_id = V_entity_id
       AND   formula_status >= V_entity_status;
Line: 1308

       SELECT routing_status
       FROM  fm_rout_hdr
       WHERE routing_id = V_entity_id
       AND   routing_status >= V_entity_status;
Line: 1317

       /*Check all the operations inserted are of status APFLU or APFGU*/
        IF (V_entity_type = 'OPERATION') THEN
                OPEN Cur_get_def_oprn_status;
Line: 1376

    /* this cursor selects the activities in the appropriate order, making the seq dep activity
    the first one the the others by offset then activity then the tie breaker of the surrogate
    key. The seq dep ind will hold the sequence numbers so we need to take those out of
    for validation purposes. The column seq_dep_order will make the seq dep activity first
    then all others will follow */

    CURSOR Cur_get_activities (V_oprn_id IN NUMBER) IS
      SELECT oprn_line_id, NVL(sequence_dependent_ind,-1) sequence_dependent_ind
      FROM   gmd_operation_activities
      WHERE  oprn_id = v_oprn_id
	AND  NVL(sequence_dependent_ind, 0) <> 1
      ORDER BY
       offset_interval,
       activity,
       oprn_line_id;
Line: 1406

         no need to update it */
      IF X_seq_dep_ind <> X_seq_num THEN
        UPDATE gmd_operation_activities
        SET    sequence_dependent_ind = X_seq_num,
               last_update_date = SYSDATE,
               last_updated_by = P_user_id,
               last_update_login = P_login_id
        WHERE  oprn_line_id = X_oprn_line_id;
Line: 1455

    SELECT gmd_recipe_validity_id_s.NEXTVAL
    FROM   FND_DUAL;
Line: 1459

    SELECT 	creation_date, formula_status, owner_organization_id
    FROM	fm_form_mst_b
    WHERE	formula_id = p_formula_id;
Line: 1465

    SELECT  inventory_item_id, revision, detail_uom, qty
    FROM    fm_matl_dtl
    WHERE   formula_id = p_formula_id
    AND     line_type = 1
    ORDER BY line_no;
Line: 1474

    SELECT 	*
    FROM	gmd_recipe_generation
    WHERE 	(organization_id = l_orgn_id
	         OR organization_id IS NULL)
    ORDER BY organization_id;
Line: 1484

    SELECT MAX(preference)
    FROM   gmd_recipe_validity_rules
    WHERE  inventory_item_id = v_item_id
    AND    organization_id = v_organization_id
    AND    recipe_use = v_recipe_use
    AND    NVL(end_date, v_start_date) >= v_start_date
    AND    start_date <= NVL(v_end_date, start_date)
    AND    inv_max_qty >= 0
    AND    inv_min_qty <= 999999
    AND    validity_rule_status < 800
    AND    delete_mark = 0;
Line: 1589

    l_recipe_vr_tbl.last_updated_by := l_user_id;
Line: 1590

    l_recipe_vr_tbl.last_update_date := SYSDATE;
Line: 1591

    l_recipe_vr_tbl.last_update_login := l_login_id;
Line: 1592

    l_recipe_vr_tbl.delete_mark := 0;
Line: 1669

    SELECT 	formula_no, formula_vers, formula_desc1,
                owner_organization_id,  formula_status, owner_id
    FROM	fm_form_mst_b
    WHERE	formula_id = p_formula_id;
Line: 1677

    SELECT routing_no , routing_vers
    FROM GMD_ROUTINGS_B
    WHERE routing_id = p_routing_id;
Line: 1683

    SELECT gmd_recipe_id_s.NEXTVAL
    FROM   FND_DUAL;
Line: 1687

    SELECT  inventory_item_id
    FROM    fm_matl_dtl
    WHERE   formula_id = p_formula_id
    AND	    line_type = 1;
Line: 1693

    SELECT 	recipe_naming_convention, created_by, last_update_login
    FROM	gmd_recipe_generation
    WHERE 	(organization_id  = l_orgn_id OR
                 organization_id IS NULL)
    ORDER BY organization_id;
Line: 1701

	SELECT	max(recipe_version)
	FROM	gmd_recipes_b
	WHERE	recipe_no = l_recipe_no;
Line: 1707

	SELECT	*
	FROM	gmd_recipes_b
	WHERE	recipe_no = l_recipe_no;
Line: 1713

	SELECT	description item_desc1, concatenated_segments item_no
	FROM	mtl_system_items_kfv
	WHERE	inventory_item_id = l_item_id;
Line: 1720

       SELECT formula_desc1
       FROM   fm_form_mst_tl
       WHERE  formula_id = p_formula_id
       AND    language   = USERENV('LANG');
Line: 1728

l_delete_mark			NUMBER(5);
Line: 1857

    l_recipe_tbl.delete_mark := 0;
Line: 1860

    l_recipe_tbl.last_updated_by := l_user_id;
Line: 1861

    l_recipe_tbl.last_update_date := sysdate;
Line: 1862

    l_recipe_tbl.last_update_login := l_login_id;
Line: 1887

         SELECT 1
	 FROM   mtl_parameters
         WHERE  organization_id = V_organization_id
	 AND    process_enabled_flag = 'Y';
Line: 1934

      SELECT inventory_item_id
      FROM   fm_matl_dtl d
      WHERE  formula_id = p_formula_id
      AND    NOT EXISTS (SELECT 1
                         FROM   mtl_system_items_b
                         WHERE  inventory_item_id = d.inventory_item_id
                         AND    organization_id = V_organization_id
			 AND    recipe_enabled_flag = 'Y');
Line: 1943

      SELECT inventory_item_id
      FROM   fm_matl_dtl
      WHERE  formula_id = p_formula_id;
Line: 1948

      SELECT d.revision, b.concatenated_segments
      FROM   fm_matl_dtl d, mtl_system_items_kfv b
      WHERE  formula_id = p_formula_id
      AND    b.inventory_item_id = d.inventory_item_id
      AND    b.organization_id = V_organization_id
      AND    revision IS NOT NULL
      AND    NOT EXISTS (SELECT 1
                         FROM   mtl_item_revisions
                         WHERE  inventory_item_id = d.inventory_item_id
                         AND    organization_id = V_organization_id
                         AND    revision = d.revision);
Line: 1961

      SELECT inventory_item_id
      FROM   fm_matl_dtl d
      WHERE  formula_id = p_formula_id
      AND    NOT EXISTS (SELECT 1
                         FROM   mtl_system_items_b
                         WHERE  inventory_item_id = d.inventory_item_id
                         AND    organization_id = V_organization_id
                         AND    process_execution_enabled_flag = 'Y');
Line: 1971

      SELECT inventory_item_id
      FROM   fm_matl_dtl d
      WHERE  formula_id = p_formula_id
      AND    NOT EXISTS (SELECT 1
                         FROM   mtl_system_items_b
                         WHERE  inventory_item_id = d.inventory_item_id
                         AND    organization_id = V_organization_id
                         AND    process_costing_enabled_flag = 'Y');
Line: 1982

      SELECT inventory_item_id
      FROM   fm_matl_dtl d
      WHERE  formula_id = p_formula_id
      AND    NOT EXISTS (SELECT 1
                         FROM   mtl_system_items_b
                         WHERE  inventory_item_id = d.inventory_item_id
                         AND    organization_id = V_organization_id
			 AND    serial_number_control_code IN (1,6));
Line: 1993

      SELECT concatenated_segments
      FROM   mtl_system_items_kfv
      WHERE  inventory_item_id = V_inventory_item_id;
Line: 1998

      SELECT organization_id
      FROM   mtl_parameters
      WHERE  organization_code = V_org_code;
Line: 2003

      SELECT organization_code
      FROM   mtl_parameters
      WHERE  organization_id = V_org_id;
Line: 2225

      Select 1 from dual
      Where exists (Select 1 from mtl_units_of_measure
                    Where uom_code = pItem_uom_code);
Line: 2254

        SELECT parameter_name, parameter_value, parameter_type
        FROM   gmd_parameters_hdr h, gmd_parameters_dtl d
        WHERE  h.parameter_id = d.parameter_id
        AND    h.organization_id = P_orgn_id
        UNION
        SELECT parameter_name, parameter_value, parameter_type
        FROM   gmd_parameters_hdr h, gmd_parameters_dtl d
        WHERE  h.parameter_id = d.parameter_id
        AND    h.organization_id IS NULL
        AND  NOT EXISTS (SELECT 1
                         FROM  gmd_parameters_hdr h1, gmd_parameters_dtl d1
                         WHERE h1.parameter_id    = d1.parameter_id
                         AND   h1.organization_id = P_orgn_id
                         AND   d1.parameter_name  = d.parameter_name);
Line: 2271

        SELECT plant_ind, lab_ind
        FROM gmd_parameters_hdr
        WHERE organization_id = P_orgn_id;
Line: 2388

        SELECT parameter_value
        FROM   gmd_parameters_hdr h, gmd_parameters_dtl d
        WHERE  h.parameter_id = d.parameter_id
        AND    h.organization_id = P_orgn_id
        AND    d.parameter_name = P_parm_name
        UNION
        SELECT parameter_value
        FROM   gmd_parameters_hdr h, gmd_parameters_dtl d
        WHERE  h.parameter_id = d.parameter_id
        AND    h.organization_id IS NULL
        AND    d.parameter_name = P_parm_name
        AND  NOT EXISTS (SELECT 1
                         FROM  gmd_parameters_hdr h1, gmd_parameters_dtl d1
                         WHERE h1.parameter_id    = d1.parameter_id
                         AND   h1.organization_id = P_orgn_id
                         AND   d1.parameter_name  = d.parameter_name);
Line: 2437

SELECT original_inventory_item_id FROM GMD_ITEM_SUBSTITUTION_HDR_B
                                  WHERE substitution_id = p_substitution_id;
Line: 2440

SELECT count(1) FROM GMD_ITEM_SUBSTITUTION_HDR_B
                WHERE original_inventory_item_id = l_item_id
                AND ( (p_exclude_context = 'Y'  AND substitution_id <> p_substitution_id)
                       OR p_exclude_context = 'N'
                    );
Line: 2446

SELECT start_date FROM GMD_ITEM_SUBSTITUTION_HDR_B
                  WHERE original_inventory_item_id = l_item_id
                  AND ( (p_exclude_context = 'Y' AND substitution_id <> p_substitution_id)
                      OR p_exclude_context = 'N'
                      );
Line: 2452

SELECT start_date FROM GMD_ITEM_SUBSTITUTION_HDR_B
                  WHERE original_inventory_item_id = l_item_id
                  AND ( (p_exclude_context = 'Y'  AND substitution_id <> p_substitution_id)
                        OR p_exclude_context = 'N'
                      )
                  ORDER BY START_DATE;
Line: 2493

** Name    : update_end_date
** Notes       : This procedure updates the material end dates based on
**               the substitution start date
**               If everything is fine then OUT parameter
**               x_return_status is set to 'S' else appropriate
**               error message is put on the stack and error
**               is returned.
**
** HISTORY
**   30-Apr-2005 B4479101 TDaniel  Created.
**   28-Nov-2006 B5640547 akaruppa Removed the organization_id check when
**                                 updating fm_matl_dtl with end date.
**+========================================================================+*/

PROCEDURE update_end_date (p_substitution_id IN NUMBER) IS

  CURSOR Cur_get_substitution IS
    SELECT i.original_inventory_item_id, i.start_date, i.substitution_status,
           f.formula_id, i.owner_organization_id
    FROM   gmd_item_substitution_hdr_b i, gmd_formula_substitution f
    WHERE  i.substitution_id = p_substitution_id
    AND    i.substitution_id = f.substitution_id;
Line: 2517

    SELECT MIN(i.start_date)
    FROM   gmd_item_substitution_hdr_b i, gmd_formula_substitution f
    WHERE  f.formula_id = V_formula_id
    AND    i.original_inventory_item_id = V_item_id
    AND    i.owner_organization_id = V_orgn_id
    AND    i.substitution_id <> p_substitution_id
    AND    i.substitution_id = f.substitution_id
    AND    i.substitution_status BETWEEN 700 AND 799;
Line: 2530

    /* Substitution is approved so lets update the formula line end date */
    IF l_rec.substitution_status BETWEEN 700 AND 799 THEN
      UPDATE fm_matl_dtl
      SET    ingredient_end_date = l_rec.start_date
      WHERE  formula_id = l_rec.formula_id
      AND    line_type = -1
      AND    inventory_item_id = l_rec.original_inventory_item_id
--      AND    organization_id   = l_rec.owner_organization_id
      AND    (ingredient_end_date IS NULL OR ingredient_end_date > l_rec.start_date);
Line: 2548

      UPDATE fm_matl_dtl
      SET    ingredient_end_date = l_start_date
      WHERE  formula_id = l_rec.formula_id
      AND    line_type = -1
      AND    inventory_item_id = l_rec.original_inventory_item_id;
Line: 2557

END update_end_date;
Line: 2597

    SELECT 1
    FROM   sys.dual
    WHERE  EXISTS (SELECT 1
                   FROM   mtl_parameters
                   WHERE  master_organization_id = p_organization_id);
Line: 2666

    SELECT revision
    FROM   fm_matl_dtl
    WHERE  formula_id = p_formula_id
    AND    inventory_item_id = p_inventory_item_id
    AND    line_type = 1
    ORDER BY revision;
Line: 2674

    SELECT 1
    FROM   sys.dual
    WHERE EXISTS (SELECT 1
                  FROM   mtl_item_revisions
                  WHERE  inventory_item_id = p_inventory_item_id
                  AND    organization_id = p_organization_id
                  AND    revision = V_revision);