449: END LOOP;
450: ELSE -- Some parameter is passed
451:
452: -- Open cursor.
453: l_cursor_id := DBMS_SQL.OPEN_CURSOR;
454:
455: -- Building the dynamic query based on parameters passed.
456: -- Moac Changed below cursor to use oe_order_headers_all
457: /*Start MOAC_SQL_CHANGE */
592: oe_debug_pub.add('Query : ' || l_stmt, 1 ) ;
593: END IF;
594:
595: -- Parse statement.
596: DBMS_SQL.Parse(l_cursor_id,l_stmt,DBMS_SQL.NATIVE);
597:
598: -- Bind variables
599: -- Moac Start
600: IF p_org_id is NOT NULL THEN
597:
598: -- Bind variables
599: -- Moac Start
600: IF p_org_id is NOT NULL THEN
601: DBMS_SQL.Bind_Variable(l_cursor_id, ':org_id', p_org_id);
602: END IF;
603: -- Moac End
604:
605: IF p_order_number_low IS NOT NULL THEN
602: END IF;
603: -- Moac End
604:
605: IF p_order_number_low IS NOT NULL THEN
606: DBMS_SQL.Bind_Variable(l_cursor_id, ':order_number_low',
607: p_order_number_low);
608: END IF;
609: IF p_order_number_high IS NOT NULL THEN
610: DBMS_SQL.Bind_Variable(l_cursor_id, ':order_number_high',
606: DBMS_SQL.Bind_Variable(l_cursor_id, ':order_number_low',
607: p_order_number_low);
608: END IF;
609: IF p_order_number_high IS NOT NULL THEN
610: DBMS_SQL.Bind_Variable(l_cursor_id, ':order_number_high',
611: p_order_number_high);
612: END IF;
613: IF p_request_date_low IS NOT NULL THEN
614: DBMS_SQL.Bind_Variable(l_cursor_id, ':request_date_low',
610: DBMS_SQL.Bind_Variable(l_cursor_id, ':order_number_high',
611: p_order_number_high);
612: END IF;
613: IF p_request_date_low IS NOT NULL THEN
614: DBMS_SQL.Bind_Variable(l_cursor_id, ':request_date_low',
615: l_request_date_low);
616: END IF;
617: IF p_request_date_high IS NOT NULL THEN
618: DBMS_SQL.Bind_Variable(l_cursor_id, ':request_date_high',
614: DBMS_SQL.Bind_Variable(l_cursor_id, ':request_date_low',
615: l_request_date_low);
616: END IF;
617: IF p_request_date_high IS NOT NULL THEN
618: DBMS_SQL.Bind_Variable(l_cursor_id, ':request_date_high',
619: l_request_date_high);
620: END IF;
621: IF p_customer_po_number IS NOT NULL THEN
622: DBMS_SQL.Bind_Variable(l_cursor_id, ':customer_po_number',
618: DBMS_SQL.Bind_Variable(l_cursor_id, ':request_date_high',
619: l_request_date_high);
620: END IF;
621: IF p_customer_po_number IS NOT NULL THEN
622: DBMS_SQL.Bind_Variable(l_cursor_id, ':customer_po_number',
623: p_customer_po_number);
624: END IF;
625: IF p_ship_to_location IS NOT NULL THEN
626: DBMS_SQL.Bind_Variable(l_cursor_id, ':ship_to_location',
622: DBMS_SQL.Bind_Variable(l_cursor_id, ':customer_po_number',
623: p_customer_po_number);
624: END IF;
625: IF p_ship_to_location IS NOT NULL THEN
626: DBMS_SQL.Bind_Variable(l_cursor_id, ':ship_to_location',
627: p_ship_to_location);
628: END IF;
629: IF p_order_type IS NOT NULL THEN
630: DBMS_SQL.Bind_Variable(l_cursor_id, ':order_type', p_order_type);
626: DBMS_SQL.Bind_Variable(l_cursor_id, ':ship_to_location',
627: p_ship_to_location);
628: END IF;
629: IF p_order_type IS NOT NULL THEN
630: DBMS_SQL.Bind_Variable(l_cursor_id, ':order_type', p_order_type);
631: END IF;
632: IF p_customer IS NOT NULL THEN
633: DBMS_SQL.Bind_Variable(l_cursor_id, ':customer', p_customer);
634: END IF;
629: IF p_order_type IS NOT NULL THEN
630: DBMS_SQL.Bind_Variable(l_cursor_id, ':order_type', p_order_type);
631: END IF;
632: IF p_customer IS NOT NULL THEN
633: DBMS_SQL.Bind_Variable(l_cursor_id, ':customer', p_customer);
634: END IF;
635: IF p_item IS NOT NULL THEN
636: DBMS_SQL.Bind_Variable(l_cursor_id, ':item', p_item);
637: END IF;
632: IF p_customer IS NOT NULL THEN
633: DBMS_SQL.Bind_Variable(l_cursor_id, ':customer', p_customer);
634: END IF;
635: IF p_item IS NOT NULL THEN
636: DBMS_SQL.Bind_Variable(l_cursor_id, ':item', p_item);
637: END IF;
638: IF p_ordered_date_low IS NOT NULL THEN
639: DBMS_SQL.Bind_Variable(l_cursor_id, ':ordered_date_low',
640: l_ordered_date_low);
635: IF p_item IS NOT NULL THEN
636: DBMS_SQL.Bind_Variable(l_cursor_id, ':item', p_item);
637: END IF;
638: IF p_ordered_date_low IS NOT NULL THEN
639: DBMS_SQL.Bind_Variable(l_cursor_id, ':ordered_date_low',
640: l_ordered_date_low);
641: END IF;
642: IF p_ordered_date_high IS NOT NULL THEN
643: DBMS_SQL.Bind_Variable(l_cursor_id, ':ordered_date_high',
639: DBMS_SQL.Bind_Variable(l_cursor_id, ':ordered_date_low',
640: l_ordered_date_low);
641: END IF;
642: IF p_ordered_date_high IS NOT NULL THEN
643: DBMS_SQL.Bind_Variable(l_cursor_id, ':ordered_date_high',
644: l_ordered_date_high);
645: END IF;
646: IF p_warehouse IS NOT NULL THEN
647: DBMS_SQL.Bind_Variable(l_cursor_id, ':warehouse', p_warehouse);
643: DBMS_SQL.Bind_Variable(l_cursor_id, ':ordered_date_high',
644: l_ordered_date_high);
645: END IF;
646: IF p_warehouse IS NOT NULL THEN
647: DBMS_SQL.Bind_Variable(l_cursor_id, ':warehouse', p_warehouse);
648: END IF;
649: IF p_demand_class IS NOT NULL THEN
650: DBMS_SQL.Bind_Variable(l_cursor_id, ':demand_class', p_demand_class);
651: END IF;
646: IF p_warehouse IS NOT NULL THEN
647: DBMS_SQL.Bind_Variable(l_cursor_id, ':warehouse', p_warehouse);
648: END IF;
649: IF p_demand_class IS NOT NULL THEN
650: DBMS_SQL.Bind_Variable(l_cursor_id, ':demand_class', p_demand_class);
651: END IF;
652: IF p_planning_priority IS NOT NULL THEN
653: DBMS_SQL.Bind_Variable(l_cursor_id, ':planning_priority',
654: p_planning_priority);
649: IF p_demand_class IS NOT NULL THEN
650: DBMS_SQL.Bind_Variable(l_cursor_id, ':demand_class', p_demand_class);
651: END IF;
652: IF p_planning_priority IS NOT NULL THEN
653: DBMS_SQL.Bind_Variable(l_cursor_id, ':planning_priority',
654: p_planning_priority);
655: END IF;
656: IF p_shipment_priority IS NOT NULL THEN
657: DBMS_SQL.Bind_Variable(l_cursor_id, ':shipment_priority',
653: DBMS_SQL.Bind_Variable(l_cursor_id, ':planning_priority',
654: p_planning_priority);
655: END IF;
656: IF p_shipment_priority IS NOT NULL THEN
657: DBMS_SQL.Bind_Variable(l_cursor_id, ':shipment_priority',
658: p_shipment_priority);
659: END IF;
660: IF p_line_type IS NOT NULL THEN
661: DBMS_SQL.Bind_Variable(l_cursor_id, ':line_type', p_line_type);
657: DBMS_SQL.Bind_Variable(l_cursor_id, ':shipment_priority',
658: p_shipment_priority);
659: END IF;
660: IF p_line_type IS NOT NULL THEN
661: DBMS_SQL.Bind_Variable(l_cursor_id, ':line_type', p_line_type);
662: END IF;
663: IF p_line_request_date_low IS NOT NULL THEN
664: DBMS_SQL.Bind_Variable(l_cursor_id, ':line_request_date_low',
665: l_line_request_date_low);
660: IF p_line_type IS NOT NULL THEN
661: DBMS_SQL.Bind_Variable(l_cursor_id, ':line_type', p_line_type);
662: END IF;
663: IF p_line_request_date_low IS NOT NULL THEN
664: DBMS_SQL.Bind_Variable(l_cursor_id, ':line_request_date_low',
665: l_line_request_date_low);
666: END IF;
667: IF p_line_request_date_high IS NOT NULL THEN
668: DBMS_SQL.Bind_Variable(l_cursor_id, ':line_request_date_high',
664: DBMS_SQL.Bind_Variable(l_cursor_id, ':line_request_date_low',
665: l_line_request_date_low);
666: END IF;
667: IF p_line_request_date_high IS NOT NULL THEN
668: DBMS_SQL.Bind_Variable(l_cursor_id, ':line_request_date_high',
669: l_line_request_date_high);
670: END IF;
671: IF p_line_ship_to_location IS NOT NULL THEN
672: DBMS_SQL.Bind_Variable(l_cursor_id, ':line_ship_to_location',
668: DBMS_SQL.Bind_Variable(l_cursor_id, ':line_request_date_high',
669: l_line_request_date_high);
670: END IF;
671: IF p_line_ship_to_location IS NOT NULL THEN
672: DBMS_SQL.Bind_Variable(l_cursor_id, ':line_ship_to_location',
673: p_line_ship_to_location);
674: END IF;
675: IF p_sch_ship_date_low IS NOT NULL THEN
676: DBMS_SQL.Bind_Variable(l_cursor_id, ':sch_ship_date_low',
672: DBMS_SQL.Bind_Variable(l_cursor_id, ':line_ship_to_location',
673: p_line_ship_to_location);
674: END IF;
675: IF p_sch_ship_date_low IS NOT NULL THEN
676: DBMS_SQL.Bind_Variable(l_cursor_id, ':sch_ship_date_low',
677: l_sch_ship_date_low);
678: END IF;
679: IF p_sch_ship_date_high IS NOT NULL THEN
680: DBMS_SQL.Bind_Variable(l_cursor_id, ':sch_ship_date_high',
676: DBMS_SQL.Bind_Variable(l_cursor_id, ':sch_ship_date_low',
677: l_sch_ship_date_low);
678: END IF;
679: IF p_sch_ship_date_high IS NOT NULL THEN
680: DBMS_SQL.Bind_Variable(l_cursor_id, ':sch_ship_date_high',
681: l_sch_ship_date_high);
682: END IF;
683: IF p_sch_arrival_date_low IS NOT NULL THEN
684: DBMS_SQL.Bind_Variable(l_cursor_id, ':sch_arrival_date_low',
680: DBMS_SQL.Bind_Variable(l_cursor_id, ':sch_ship_date_high',
681: l_sch_ship_date_high);
682: END IF;
683: IF p_sch_arrival_date_low IS NOT NULL THEN
684: DBMS_SQL.Bind_Variable(l_cursor_id, ':sch_arrival_date_low',
685: l_sch_arrival_date_low);
686: END IF;
687: IF p_sch_arrival_date_high IS NOT NULL THEN
688: DBMS_SQL.Bind_Variable(l_cursor_id, ':sch_arrival_date_high',
684: DBMS_SQL.Bind_Variable(l_cursor_id, ':sch_arrival_date_low',
685: l_sch_arrival_date_low);
686: END IF;
687: IF p_sch_arrival_date_high IS NOT NULL THEN
688: DBMS_SQL.Bind_Variable(l_cursor_id, ':sch_arrival_date_high',
689: l_sch_arrival_date_high);
690: END IF;
691: IF p_booked IS NOT NULL THEN
692: DBMS_SQL.Bind_Variable(l_cursor_id, ':booked', p_booked);
688: DBMS_SQL.Bind_Variable(l_cursor_id, ':sch_arrival_date_high',
689: l_sch_arrival_date_high);
690: END IF;
691: IF p_booked IS NOT NULL THEN
692: DBMS_SQL.Bind_Variable(l_cursor_id, ':booked', p_booked);
693: END IF;
694:
695: -- Map output columns
696: DBMS_SQL.Define_Column(l_cursor_id, 1, l_header_id);
692: DBMS_SQL.Bind_Variable(l_cursor_id, ':booked', p_booked);
693: END IF;
694:
695: -- Map output columns
696: DBMS_SQL.Define_Column(l_cursor_id, 1, l_header_id);
697: DBMS_SQL.Define_Column(l_cursor_id, 2, l_line_id);
698: DBMS_SQL.Define_Column(l_cursor_id, 3, l_org_id); -- Moac
699:
700: IF l_debug_level > 0 THEN
693: END IF;
694:
695: -- Map output columns
696: DBMS_SQL.Define_Column(l_cursor_id, 1, l_header_id);
697: DBMS_SQL.Define_Column(l_cursor_id, 2, l_line_id);
698: DBMS_SQL.Define_Column(l_cursor_id, 3, l_org_id); -- Moac
699:
700: IF l_debug_level > 0 THEN
701: oe_debug_pub.add('Before executing query.',1);
694:
695: -- Map output columns
696: DBMS_SQL.Define_Column(l_cursor_id, 1, l_header_id);
697: DBMS_SQL.Define_Column(l_cursor_id, 2, l_line_id);
698: DBMS_SQL.Define_Column(l_cursor_id, 3, l_org_id); -- Moac
699:
700: IF l_debug_level > 0 THEN
701: oe_debug_pub.add('Before executing query.',1);
702: END IF;
701: oe_debug_pub.add('Before executing query.',1);
702: END IF;
703:
704: -- Execute query.
705: l_retval := DBMS_SQL.Execute(l_cursor_id);
706:
707: IF l_debug_level > 0 THEN
708: oe_debug_pub.add('Execution Result : ' || l_retval, 2) ;
709: END IF;
714: IF l_debug_level > 0 THEN
715: oe_debug_pub.add('Execution Result : ' || l_retval, 2) ;
716: END IF;
717:
718: IF DBMS_SQL.Fetch_Rows(l_cursor_id) = 0 THEN
719: EXIT;
720: END IF;
721:
722: DBMS_SQL.Column_Value(l_cursor_id, 1, l_header_id);
718: IF DBMS_SQL.Fetch_Rows(l_cursor_id) = 0 THEN
719: EXIT;
720: END IF;
721:
722: DBMS_SQL.Column_Value(l_cursor_id, 1, l_header_id);
723: DBMS_SQL.Column_Value(l_cursor_id, 2, l_line_id);
724: DBMS_SQL.Column_Value(l_cursor_id, 3, l_org_id); -- Moac
725:
726:
719: EXIT;
720: END IF;
721:
722: DBMS_SQL.Column_Value(l_cursor_id, 1, l_header_id);
723: DBMS_SQL.Column_Value(l_cursor_id, 2, l_line_id);
724: DBMS_SQL.Column_Value(l_cursor_id, 3, l_org_id); -- Moac
725:
726:
727: IF l_debug_level > 0 THEN
720: END IF;
721:
722: DBMS_SQL.Column_Value(l_cursor_id, 1, l_header_id);
723: DBMS_SQL.Column_Value(l_cursor_id, 2, l_line_id);
724: DBMS_SQL.Column_Value(l_cursor_id, 3, l_org_id); -- Moac
725:
726:
727: IF l_debug_level > 0 THEN
728: oe_debug_pub.add('***** 1. Processing Line Id '||
1380: END IF;
1381: END LOOP; -- loop for each row of dynamic query.
1382:
1383: -- close the cursor
1384: DBMS_SQL.Close_Cursor(l_cursor_id);
1385:
1386: END IF; -- if parameters passed are null.
1387:
1388: OE_MSG_PUB.Save_Messages(p_request_id => to_number(l_request_id));
1423:
1424: WHEN OTHERS THEN
1425: fnd_file.put_line(FND_FILE.LOG, 'Unexpected error in OE_SCH_CONC_REQUESTS.Request');
1426: fnd_file.put_line(FND_FILE.LOG, substr(sqlerrm, 1, 2000));
1427: DBMS_SQL.Close_Cursor(l_cursor_id);
1428:
1429: END Request;
1430:
1431: END OE_SCH_CONC_REQUESTS;