DBA Data[Home] [Help]

APPS.OKE_DEFAULTING_PKG SQL Statements

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

Line: 53

  , P_Update_Yn			IN VARCHAR2
  , P_Header_ID			IN NUMBER
  , P_Line_ID			IN NUMBER
  , X_Return_Status		OUT NOCOPY VARCHAR2
  , X_Msg_Count			OUT NOCOPY NUMBER
  , X_Msg_Data			OUT NOCOPY VARCHAR2
  , X_Counter			OUT NOCOPY NUMBER ) IS

    l_api_version CONSTANT NUMBER := 1;
Line: 76

    SELECT DECODE(Buy_Or_Sell, 'B', 'IN', 'OUT') Direction
    , Inv_Organization_ID
    FROM okc_k_headers_b
    WHERE ID = P_Header_ID;
Line: 112

    IF  NVL(P_Update_Yn, 'N') = 'N' THEN  /* New deliverable default */



      IF P_Line_ID > 0 THEN  /* Line Default */


        Create_New_L (P_Initiate_Msg_List => G_False
		, X_Return_Status		=> L_Return_Status
		, X_Msg_Count			=> X_Msg_Count
		, X_Msg_Data			=> X_Msg_Data
		, P_Header_ID			=> P_Header_ID
		, P_Line_ID			=> P_Line_ID
		, P_Direction			=> L_Direction
		, P_Inventory_Org_ID		=> L_Inventory_Org_ID
		, X_Counter			=> X_Counter);
Line: 163

        Update_Line( P_Init_Msg_List =>  G_False
		, X_Return_Status 		=> L_Return_Status
		, X_Msg_Count			=> X_Msg_Count
		, X_Msg_Data			=> X_Msg_Data
		, P_Header_ID			=> P_Header_ID
		, P_Line_ID			=> P_Line_ID
		, P_Direction			=> L_Direction
		, P_Inventory_Org_ID		=> L_Inventory_Org_ID
		, X_Counter 			=> X_Counter);
Line: 183

          Update_Batch ( P_Init_Msg_List => G_False
		, X_Return_Status 		=> L_Return_Status
		, X_Msg_Count			=> X_Msg_Count
		, X_Msg_Data			=> X_Msg_Data
		, P_Header_ID			=> P_Header_ID
		, P_Direction			=> L_Direction
		, P_Inventory_Org_ID		=> L_Inventory_Org_ID
		, X_Counter			=> L_Counter);
Line: 267

    select object1_id1, object1_id2, jtot_object1_code
    from okc_k_party_roles_b
    where dnz_chr_id = p_header_id and cle_id = p_id
    and rle_code = p_code;
Line: 273

    select object1_id1, object1_id2, jtot_object1_code
    from okc_k_party_roles_b
    where dnz_chr_id = p_header_id and chr_id = p_id
    and rle_code = p_code;
Line: 279

    select Max(a.level_sequence) from okc_ancestrys a
    where a.cle_id = p_line_id
    and exists(select 'x' from okc_k_party_roles_b b where dnz_chr_id = p_header_id and b.cle_id = a.cle_id_ascendant and b.rle_code = p_code and object1_id1 is not null);
Line: 284

    select count(*) from okc_k_party_roles_b
    where dnz_chr_id = p_header_id and chr_id = p_header_id
    and rle_code = p_code
    and object1_id1 is not null;
Line: 290

    select buy_or_sell from okc_k_headers_b
    where id = p_header_id;
Line: 294

    select 'x' from okc_ancestrys
    where cle_id = p_line_id;
Line: 298

    Select 'x'
    From HR_ALL_ORGANIZATION_UNITS hr, MTL_PARAMETERS mp
    Where hr.Organization_Id = P_Id
    And mp.Organization_Id = hr.Organization_Id;
Line: 322

    select buy_or_sell into l_buy_or_sell
    from okc_k_headers_b
    where id = p_header_id;
Line: 328

      SELECT COUNT(*) INTO l_row_count
      FROM OKC_K_PARTY_ROLES_B
      WHERE dnz_chr_id = p_header_id and cle_id = p_line_id
      and rle_code = 'SHIP_FROM'
      and object1_id1 is not null;
Line: 386

	    select cle_id_ascendant into l_id
	    from okc_ancestrys
	    where cle_id = p_line_id
	    and level_sequence = l_level;
Line: 391

	    select count(*) into l_row_count
	    from okc_k_party_roles_b
	    where dnz_chr_id = p_header_id and cle_id = l_id
	    and rle_code = 'SHIP_FROM';
Line: 471

    select count(*) into l_row_count
    	from okc_k_party_roles_b
    	where dnz_chr_id = p_header_id and cle_id = p_line_id
    	and rle_code = 'SHIP_TO';
Line: 519

	    select cle_id_ascendant into l_id
	    from okc_ancestrys
	    where cle_id = p_line_id
	    and level_sequence = l_level;
Line: 524

	    select count(*) into l_row_count
	    from okc_k_party_roles_b
	    where dnz_chr_id = p_header_id and cle_id = l_id
	    and rle_code = 'SHIP_TO';
Line: 631

    SELECT Count(*)
    FROM oke_k_deliverables_b
    WHERE K_Line_ID = P_Line_ID
    AND NVL(Defaulted_Flag, 'N') = 'Y';
Line: 637

    SELECT NVL(Create_Demand, 'N')
    , NVL(Ready_To_Procure, 'N')
    , NVL(Available_For_Ship_Flag, 'N')
    , NVL(Ready_To_Bill, 'N')
    , NVL(Completed_Flag, 'N')
    FROM oke_k_deliverables_b
    WHERE K_Line_ID = P_Line_ID
    AND NVL(Defaulted_Flag, 'N') = 'Y';
Line: 732

    ELSE /* Splited deliverable, not qualify for auto-update */


      FND_MESSAGE.Set_Name('OKE', 'OKE_DTS_DATA_SPLIT');
Line: 764

    SELECT Cust_Account_ID, status
    FROM oke_cust_site_uses_v
    WHERE ID1 = P_ID;
Line: 769

    SELECT Buy_Or_Sell
    FROM OKC_K_HEADERS_B
    WHERE ID = P_ID;
Line: 774

    SELECT Vendor_ID, status
    FROM oke_vendor_sites_v
    WHERE ID1 = P_ID;
Line: 782

       SELECT location_id
        FROM hr_organization_units
        WHERE ORGANIZATION_ID = p_ID;
Line: 786

       SELECT ID1
        FROM okx_locations_v
        WHERE Organization_ID = P_ID AND status='A'
        ORDER BY ID1;
Line: 896

   SELECT 'x'
   FROM MTL_SYSTEM_ITEMS
   WHERE inventory_item_id = L_inventory_item_id
   AND organization_id = L_inventory_org;
Line: 939

    select l.k_line_id,
	l.line_number,
	l.project_id,
	l.inventory_item_id,
        SUBSTR(l.line_description, 1, 240) line_description,
	l.delivery_date,
	l.status_code,
	l.start_date,
	l.end_date,
	k.priority_code,
	h.currency_code,
        DECODE(h.buy_or_sell, 'B', 'IN', 'OUT') Direction,
	l.unit_price,
	l.uom_code,
	l.line_quantity,
	k.country_of_origin_code,
	l.subcontracted_flag,
	l.billable_flag,
	l.drop_shipped_flag,
--	l.completed_flag,
	l.shippable_flag,
	l.cfe_flag,
	l.inspection_req_flag,
	l.interim_rpt_req_flag,
	l.customer_approval_req_flag,
    	l.as_of_date,
 	l.date_of_first_submission,
	l.frequency,
	l.data_item_subtitle,
	l.copies_required,
	l.cdrl_category,
	l.data_item_name,
	l.export_flag
    from oke_k_lines_v l, okc_k_headers_b h, oke_k_headers k
    where h.id = l.header_id
    and l.k_line_id = p_id
    and h.id = k.k_header_id;
Line: 1163

    select l.k_line_id,
	l.line_number,
	l.project_id,
	l.inventory_item_id,
	substr(l.line_description, 1, 240) line_description,
	l.delivery_date,
	l.status_code,
	l.start_date,
	l.end_date,
	k.priority_code,
	h.currency_code,
        DECODE(h.buy_or_sell, 'B', 'IN', 'OUT') Direction,
	l.unit_price,
	l.uom_code,
	l.line_quantity,
	k.country_of_origin_code,
	l.subcontracted_flag,
	l.billable_flag,
	l.drop_shipped_flag,
	l.completed_flag,
	l.shippable_flag,
	l.cfe_flag,
	l.inspection_req_flag,
	l.interim_rpt_req_flag,
	l.customer_approval_req_flag,
    	l.as_of_date,
 	l.date_of_first_submission,
	l.frequency,
	l.data_item_subtitle,
	l.copies_required,
	l.cdrl_category,
	l.data_item_name,
	l.export_flag
    from oke_k_lines_v l, okc_k_headers_b h, oke_k_headers k
    where h.id = p_id
    and l.header_id = p_id
    and h.id = k.k_header_id
    and not exists (select 'x' from oke_k_deliverables_b where k_line_id = l.k_line_id and nvl(defaulted_flag, 'N') = 'Y')
    and not exists (select 'x' from okc_k_lines_b s where s.cle_id = l.k_line_id)
    and exists (select 'x' from okc_assents a
		where a.opn_code = 'CREATE_DELV'
		and a.sts_code = l.status_code
	 	and a.scs_code = 'PROJECT'
		and a.allowed_yn = 'Y');
Line: 1293

  PROCEDURE Update_Line( P_Init_Msg_List VARCHAR2
		, X_Return_Status 		OUT NOCOPY VARCHAR2
		, X_Msg_Count			OUT NOCOPY NUMBER
		, X_Msg_Data			OUT NOCOPY VARCHAR2
		, P_Header_ID			IN  NUMBER
		, P_Line_ID			IN  NUMBER
		, P_Direction			IN  VARCHAR2
		, P_Inventory_Org_ID		IN  NUMBER
		, X_Counter			OUT NOCOPY NUMBER) IS

    L_Api_Name CONSTANT VARCHAR2(30) := 'Update_Line';
Line: 1321

    CURSOR Update_L_C ( P_ID NUMBER ) IS
    SELECT l.line_number,
	l.project_id,
	l.inventory_item_id,
        SUBSTR(l.line_description, 1, 240) line_description,
	l.delivery_date,
	l.status_code,
	l.start_date,
	l.end_date,
	k.priority_code,
	h.currency_code,
        DECODE(h.buy_or_sell, 'B', 'IN', 'OUT') Direction,
	l.unit_price,
	l.uom_code,
	l.line_quantity,
	k.country_of_origin_code,
	l.subcontracted_flag,
	l.billable_flag,
	l.drop_shipped_flag,
--	l.completed_flag,
	l.shippable_flag,
	l.cfe_flag,
	l.inspection_req_flag,
	l.interim_rpt_req_flag,
	l.customer_approval_req_flag,
    	l.as_of_date,
 	l.date_of_first_submission,
	l.frequency,
	l.data_item_subtitle,
	l.copies_required,
	l.cdrl_category,
	l.data_item_name,
	l.export_flag
    from oke_k_lines_v l, okc_k_headers_b h, oke_k_headers k
    where l.k_line_id = p_id
    and h.id = l.header_id
    and k.k_header_id = l.header_id;
Line: 1360

    SELECT Deliverable_ID, Mps_Transaction_ID
    FROM oke_k_deliverables_b
    WHERE K_Line_ID = P_Line_ID
    AND NVL(Defaulted_Flag, 'N') = 'Y';
Line: 1365

    Update_L_Rec Update_L_C%ROWTYPE;
Line: 1376

        OPEN Update_L_C(P_Line_ID);
Line: 1377

        FETCH Update_L_C INTO Update_L_Rec;
Line: 1378

        CLOSE Update_L_C;
Line: 1389

    IF Update_L_Rec.inventory_item_id is not null THEN  -- need to check inventory
      IF P_Direction = 'IN' THEN  -- need to check ship to location
        IF Check_Org_Items(update_l_rec.inventory_item_id,l_ship_to_org_id) = 'N' THEN
  	    	L_ship_to_org_id := NULL;
Line: 1396

        IF Check_Org_Items(update_l_rec.inventory_item_id,l_ship_from_org_id) = 'N' THEN
          L_ship_from_org_id := NULL;
Line: 1424

	  L_DEL_REC.project_id 			:= UPDATE_L_REC.project_id;
Line: 1425

          L_DEL_REC.item_id 			:= UPDATE_L_REC.inventory_item_id;
Line: 1426

          L_DEL_REC.description                 := UPDATE_L_REC.line_description;
Line: 1427

          L_DEL_REC.delivery_date 		:= UPDATE_L_REC.delivery_date;
Line: 1428

     	  L_DEL_REC.status_code 		:= UPDATE_L_REC.status_code;
Line: 1429

   	  L_DEL_REC.start_date 			:= UPDATE_L_REC.start_date;
Line: 1430

	  L_DEL_REC.end_date 			:= UPDATE_L_REC.end_date;
Line: 1431

	  L_DEL_REC.priority_code 		:= UPDATE_L_REC.priority_code;
Line: 1432

	  L_DEL_REC.currency_code 		:= UPDATE_L_REC.currency_code;
Line: 1433

	  L_DEL_REC.unit_price 			:= UPDATE_L_REC.unit_price;
Line: 1434

	  L_DEL_REC.uom_code 			:= UPDATE_L_REC.uom_code;
Line: 1435

	  L_DEL_REC.quantity 			:= UPDATE_L_REC.line_quantity;
Line: 1436

	  L_DEL_REC.country_of_origin_code 	:= UPDATE_L_REC.country_of_origin_code;
Line: 1437

	  L_DEL_REC.subcontracted_flag 		:= UPDATE_L_REC.subcontracted_flag;
Line: 1438

	  L_DEL_REC.billable_flag 		:= UPDATE_L_REC.billable_flag;
Line: 1439

	  L_DEL_REC.drop_shipped_flag 		:= UPDATE_L_REC.drop_shipped_flag;
Line: 1441

	  L_DEL_REC.shippable_flag 		:= UPDATE_L_REC.shippable_flag;
Line: 1442

	  L_DEL_REC.cfe_req_flag 		:= UPDATE_L_REC.cfe_flag;
Line: 1443

	  L_DEL_REC.inspection_req_flag 	:= UPDATE_L_REC.inspection_req_flag;
Line: 1444

	  L_DEL_REC.interim_rpt_req_flag 	:= UPDATE_L_REC.interim_rpt_req_flag;
Line: 1445

	  L_DEL_REC.customer_approval_req_flag 	:= UPDATE_L_REC.customer_approval_req_flag;
Line: 1446

    	  L_DEL_REC.as_of_date 			:= UPDATE_L_REC.as_of_date;
Line: 1447

 	  L_DEL_REC.date_of_first_submission 	:= UPDATE_L_REC.date_of_first_submission;
Line: 1448

	  L_DEL_REC.frequency 			:= UPDATE_L_REC.frequency;
Line: 1449

	  L_DEL_REC.data_item_subtitle 		:= UPDATE_L_REC.data_item_subtitle;
Line: 1450

	  L_DEL_REC.total_num_of_copies 	:= UPDATE_L_REC.copies_required;
Line: 1451

	  L_DEL_REC.cdrl_category 		:= UPDATE_L_REC.cdrl_category;
Line: 1452

	  L_DEL_REC.data_item_name 		:= UPDATE_L_REC.data_item_name;
Line: 1453

	  L_DEL_REC.export_flag 		:= UPDATE_L_REC.export_flag;
Line: 1457

	  -- Update deliverable

	  OKE_CONTRACT_PUB.update_deliverable(
		p_api_version	=> l_api_version,
		p_init_msg_list	=> p_init_msg_list,
		x_return_status => l_return_status,
		x_msg_count     => x_msg_count,
		x_msg_data      => x_msg_data,
      		p_del_rec	=> l_del_rec,
      		x_del_rec	=> x_del_rec);
Line: 1475

	  -- If planning is initiated, update MDS as well

	  /*

          IF L_MDS_ID > 0 THEN

	    OKE_DTS_INTEGRATION_PKG.Create_MDS_Entry (
			P_Deliverable_ID 	=> L_DEL_REC.Deliverable_ID
			, X_Out_ID		=> L_Out_ID
			, X_Return_Status 	=> L_Return_Status);
Line: 1528

  END Update_Line;
Line: 1530

  PROCEDURE Update_Batch ( P_Init_Msg_List VARCHAR2
		, X_Return_Status 		OUT NOCOPY VARCHAR2
		, X_Msg_Count			OUT NOCOPY NUMBER
		, X_Msg_Data			OUT NOCOPY VARCHAR2
		, P_Header_ID			IN  NUMBER
		, P_Direction			IN  VARCHAR2
		, P_Inventory_Org_ID		IN  NUMBER
		, X_Counter			OUT NOCOPY NUMBER) IS

    L_Api_Name CONSTANT VARCHAR2(30) := 'Update_Batch';
Line: 1578

    CURSOR Update_C ( P_ID NUMBER ) IS
    SELECT l.k_line_id, b.deliverable_ID, l.line_number
    from oke_k_lines_v l, oke_k_deliverables_b b
    where b.k_header_id = p_id
    and b.k_line_id = l.k_line_id
    and nvl(l.scheduled_delv_default, 'N') = 'Y'
    and nvl(defaulted_flag, 'N') = 'Y'
    GROUP BY l.k_line_id, b.deliverable_ID, l.line_number
    HAVING count(*)=1;
Line: 1604

    FOR Update_Rec IN Update_C(P_Header_ID) LOOP

      Verify_Defaults (
	    P_Line_ID			=> UPDATE_REC.K_Line_ID
	  , X_Msg_1			=> L_Msg1
	  , X_Msg_2			=> L_Msg2
	  , X_Msg_3			=> L_Msg3
	  , X_Return_Status		=> L_Return_Status
	  , P_Calling_Level => 'H');
Line: 1616

      Update_Line(
    	P_Init_Msg_List 		=> G_False
  	, X_Return_Status 		=> L_Return_Status
  	, X_Msg_Count			=> X_Msg_Count
  	, X_Msg_Data			=> X_Msg_Data
  	, P_Header_ID			=> P_Header_ID
  	, P_Line_ID			=> Update_Rec.K_Line_ID
  	, P_Direction			=> P_Direction
  	, P_Inventory_Org_ID		=> P_Inventory_Org_ID
  	, X_Counter			=> X_Counter);
Line: 1632

	  UPDATE oke_k_lines
          SET Scheduled_Delv_Default = 'N'
          WHERE K_Line_ID = Update_Rec.K_Line_ID;
Line: 1639

        IF Check_Mps_Valid ( Update_Rec.K_Line_ID, L_Mps_S, L_Mps_F ) THEN

          OKE_DTS_ACTION_PKG.Initiate_Actions( P_Action => 'PLAN'
				, P_Action_Level	=> 3
		  		, P_Header_ID  		=> P_Header_ID
		  		, P_Line_ID    		=> Update_Rec.K_Line_ID
				, P_Deliverable_ID 	=> Update_Rec.Deliverable_ID
				, X_Return_Status	=> L_Return_Status
				, X_Msg_Data		=> L_Msg_Data
				, X_Msg_Count		=> L_Msg_Count );
Line: 1652

		    UPDATE oke_k_deliverables_b
		    SET Create_Demand = 'N'
		    WHERE Deliverable_ID = Update_Rec.Deliverable_ID;
Line: 1663

	    L_Token6_Value := UPDATE_REC.Line_Number;
Line: 1667

               ,p_new_token_value  => UPDATE_REC.Line_Number) THEN
    	    L_Token6_Value := L_Token6_Value || ', ' || UPDATE_REC.Line_Number;
Line: 1679

	    L_Token7_Value := UPDATE_REC.Line_Number;
Line: 1683

			   ,p_new_token_value  => UPDATE_REC.Line_Number) THEN
		   L_Token7_Value := L_Token7_Value || ', ' || UPDATE_REC.Line_Number;
Line: 1697

	      L_Token1_Value := UPDATE_REC.Line_Number;
Line: 1701

                   ,p_new_token_value  => UPDATE_REC.Line_Number) THEN
	            L_Token1_Value := L_Token1_Value || ', ' ||  UPDATE_REC.Line_Number;
Line: 1709

	      L_Token2_Value := UPDATE_REC.Line_Number;
Line: 1713

                   ,p_new_token_value  => UPDATE_REC.Line_Number) THEN
    	      L_Token2_Value := L_Token2_Value || ', ' ||  UPDATE_REC.Line_Number ;
Line: 1723

	      L_Token3_Value := UPDATE_REC.Line_Number;
Line: 1727

                   ,p_new_token_value  => UPDATE_REC.Line_Number) THEN
		      L_Token3_Value := L_Token3_Value || ', ' ||  UPDATE_REC.Line_Number ;
Line: 1736

	      L_Token4_Value := UPDATE_REC.Line_Number;
Line: 1740

                   ,p_new_token_value  => UPDATE_REC.Line_Number) THEN
    	      L_Token4_Value := L_Token4_Value || ', ' ||  UPDATE_REC.Line_Number ;
Line: 1749

	      L_Token5_Value := UPDATE_REC.Line_Number;
Line: 1753

                   ,p_new_token_value  => UPDATE_REC.Line_Number) THEN
    	      L_Token5_Value := L_Token5_Value || ', ' ||  UPDATE_REC.Line_Number ;
Line: 1852

  END Update_Batch;
Line: 1875

    SELECT Mps_Transaction_ID, Deliverable_ID, Create_Demand
    FROM OKE_K_DELIVERABLES_B
    WHERE K_Line_ID = P_Line_ID
     AND NVL(Defaulted_Flag, 'N') = 'Y'
    AND NVL(Create_Demand, 'N') = 'Y';
Line: 1882

    SELECT DECODE(H.Buy_Or_Sell, 'B', 'IN', 'OUT')
    , L.Header_ID
    , L.Inventory_Item_ID
    , L.Line_Quantity
    , L.Line_Number
    FROM okc_k_headers_b H, oke_k_lines_v L
    WHERE H.ID = L.Header_ID
    AND L.K_Line_ID = P_Line_ID;
Line: 1892

    SELECT 'X'
    FROM oke_system_items_v
    WHERE ID1 = L_Item_ID
    AND ID2 = L_Inventory_Org_ID;