DBA Data[Home] [Help]

APPS.MSC_SDA_PKG dependencies on MSC_SUPPLIES

Line 128: c_msc_supplies constant number := 1;

124: c_all_region_type_text varchar2(300) := msc_sda_utils.c_all_region_type_text;
125: c_all_org_type_text varchar2(300) := msc_sda_utils.c_all_org_type_text;
126:
127: --constants for p_souce_type
128: c_msc_supplies constant number := 1;
129: c_msc_demands constant number := 2;
130:
131: --constants for p_type_flag
132: c_row_type_flag constant number := 1;

Line 391: -- msc_supplies order type 81

387: -- msc_demands origination_type 65 //pabram..need to check
388: c_row2_total_ret_fcst constant integer:= 9;
389: -- nvl(returns manual forecast, returns fcst + returns dmd schedule) //pabram..need to check
390: c_row2_ret_fcst constant integer:= 10;
391: -- msc_supplies order type 81
392: c_row2_ret_dmd_schd constant integer:= 11;
393: -- msc_supplies order type 82
394: c_row2_ret_manual_fcst constant integer:= 12;
395: -- msc_supplies order type 83

Line 393: -- msc_supplies order type 82

389: -- nvl(returns manual forecast, returns fcst + returns dmd schedule) //pabram..need to check
390: c_row2_ret_fcst constant integer:= 10;
391: -- msc_supplies order type 81
392: c_row2_ret_dmd_schd constant integer:= 11;
393: -- msc_supplies order type 82
394: c_row2_ret_manual_fcst constant integer:= 12;
395: -- msc_supplies order type 83
396: c_row2_ret_bestfit_fcst constant integer:= 13;
397: -- msc_supplies order type 84

Line 395: -- msc_supplies order type 83

391: -- msc_supplies order type 81
392: c_row2_ret_dmd_schd constant integer:= 11;
393: -- msc_supplies order type 82
394: c_row2_ret_manual_fcst constant integer:= 12;
395: -- msc_supplies order type 83
396: c_row2_ret_bestfit_fcst constant integer:= 13;
397: -- msc_supplies order type 84
398: c_row2_usage_fcst constant integer:= 14;
399: -- Usage Forecast

Line 397: -- msc_supplies order type 84

393: -- msc_supplies order type 82
394: c_row2_ret_manual_fcst constant integer:= 12;
395: -- msc_supplies order type 83
396: c_row2_ret_bestfit_fcst constant integer:= 13;
397: -- msc_supplies order type 84
398: c_row2_usage_fcst constant integer:= 14;
399: -- Usage Forecast
400: c_row2_popultn_fcst constant integer:= 15;
401: -- Population based Forecast

Line 424: -- returns history ,msc_supplies

420: -- pivot row types
421: c_row_dmd_hist constant integer:= 1;
422: -- demand history ,msc_demands
423: c_row_returns_hist constant integer:= 2;
424: -- returns history ,msc_supplies
425: --
426: -- history view ends
427: --
428:

Line 1549: msc_supplies ms,

1545: null, ms.new_order_quantity,
1546: ms.daily_rate) )) new_quantity,
1547: sum(nvl(ms.old_order_quantity,0)) old_quantity
1548: from
1549: msc_supplies ms,
1550: msc_analysis_query maq,
1551: msc_form_query mfq1, -- org-list
1552: msc_form_query mfq2, -- item-list
1553: msc_plans mp,

Line 2224: msc_supplies ms,

2220: null, ms.new_order_quantity,
2221: ms.daily_rate) )) new_quantity,
2222: 0 old_quantity
2223: from
2224: msc_supplies ms,
2225: msc_analysis_query maq,
2226: msc_form_query mfq1, -- region-to-org-list
2227: msc_form_query mfq2, -- item-list
2228: msc_plans mp,

Line 2287: --engine will not flush demand history and returns history into msc_supplies/msc_demands

2283: ---------------------------
2284: --- HISTORY VIEW CUSROR ---
2285: ---------------------------
2286:
2287: --engine will not flush demand history and returns history into msc_supplies/msc_demands
2288: --ui needs to look at msd views to get this information
2289: cursor hist_snapshot_cur is
2290: select
2291: maq.row_index,

Line 2338: msc_supplies ms,

2334: msc_sda_pkg.getHistEndDate(mfq3.date2, l_min_date, l_max_date, ms.new_schedule_date) old_date,
2335: sum(ms.new_order_quantity) new_quantity,
2336: 0 old_quantity
2337: from
2338: msc_supplies ms,
2339: msc_analysis_query maq,
2340: msc_form_query mfq1, -- region-to-org-list
2341: msc_form_query mfq2, -- item-list
2342: msc_form_query mfq3 -- history calendar

Line 3389: p_from_table := 'msc_supplies';

3385: elsif (p_row_offset = c_row2_bestfit_fcst) then
3386: p_from_table := 'msc_demands';
3387: p_order_type_list := c_dmd2_bestfit_fcst;
3388: elsif (p_row_offset = c_row2_total_ret_fcst) then
3389: p_from_table := 'msc_supplies';
3390: p_order_type_list := to_char(c_sup2_rtns_manual_fcst) ||','|| to_char(c_sup2_rtns_fcst) ||','|| to_char(c_sup2_rtns_dmd_schd);
3391: elsif (p_row_offset = c_row2_ret_fcst) then
3392: p_from_table := 'msc_supplies';
3393: p_order_type_list := c_sup2_rtns_fcst;

Line 3392: p_from_table := 'msc_supplies';

3388: elsif (p_row_offset = c_row2_total_ret_fcst) then
3389: p_from_table := 'msc_supplies';
3390: p_order_type_list := to_char(c_sup2_rtns_manual_fcst) ||','|| to_char(c_sup2_rtns_fcst) ||','|| to_char(c_sup2_rtns_dmd_schd);
3391: elsif (p_row_offset = c_row2_ret_fcst) then
3392: p_from_table := 'msc_supplies';
3393: p_order_type_list := c_sup2_rtns_fcst;
3394: elsif (p_row_offset = c_row2_ret_dmd_schd) then
3395: p_from_table := 'msc_supplies';
3396: p_order_type_list := c_sup2_rtns_dmd_schd;

Line 3395: p_from_table := 'msc_supplies';

3391: elsif (p_row_offset = c_row2_ret_fcst) then
3392: p_from_table := 'msc_supplies';
3393: p_order_type_list := c_sup2_rtns_fcst;
3394: elsif (p_row_offset = c_row2_ret_dmd_schd) then
3395: p_from_table := 'msc_supplies';
3396: p_order_type_list := c_sup2_rtns_dmd_schd;
3397: elsif (p_row_offset = c_row2_ret_manual_fcst) then
3398: p_from_table := 'msc_supplies';
3399: p_order_type_list := c_sup2_rtns_manual_fcst;

Line 3398: p_from_table := 'msc_supplies';

3394: elsif (p_row_offset = c_row2_ret_dmd_schd) then
3395: p_from_table := 'msc_supplies';
3396: p_order_type_list := c_sup2_rtns_dmd_schd;
3397: elsif (p_row_offset = c_row2_ret_manual_fcst) then
3398: p_from_table := 'msc_supplies';
3399: p_order_type_list := c_sup2_rtns_manual_fcst;
3400: elsif (p_row_offset = c_row2_ret_bestfit_fcst) then
3401: p_from_table := 'msc_supplies';
3402: p_order_type_list := c_sup2_rtns_bestfit_fcst;

Line 3401: p_from_table := 'msc_supplies';

3397: elsif (p_row_offset = c_row2_ret_manual_fcst) then
3398: p_from_table := 'msc_supplies';
3399: p_order_type_list := c_sup2_rtns_manual_fcst;
3400: elsif (p_row_offset = c_row2_ret_bestfit_fcst) then
3401: p_from_table := 'msc_supplies';
3402: p_order_type_list := c_sup2_rtns_bestfit_fcst;
3403: elsif (p_row_offset = c_row2_usage_fcst) then
3404: p_from_table := 'msc_demands';
3405: p_order_type_list := c_dmd2_usage_fcst;

Line 3447: p_from_table := 'msc_supplies';

3443: p_order_type_list := to_char(c_dmd_fcst) ||', '|| to_char(c_dmd_so) ||', '|| to_char(c_dmd_so_mds)
3444: ||', '|| to_char(c_dmd_pod)
3445: ||', '|| to_char(c_dmd_mps) ||', '|| to_char(c_dmd_manual_mds);
3446: elsif (p_row_offset = c_row_onhand) then --10;
3447: p_from_table := 'msc_supplies';
3448: p_order_type_list := c_sup_onhand;
3449: elsif (p_row_offset = c_row_transit) then --11;
3450: p_from_table := 'msc_supplies';
3451: p_order_type_list := c_sup_intrnst_shpmt;

Line 3450: p_from_table := 'msc_supplies';

3446: elsif (p_row_offset = c_row_onhand) then --10;
3447: p_from_table := 'msc_supplies';
3448: p_order_type_list := c_sup_onhand;
3449: elsif (p_row_offset = c_row_transit) then --11;
3450: p_from_table := 'msc_supplies';
3451: p_order_type_list := c_sup_intrnst_shpmt;
3452: elsif (p_row_offset = c_row_receiving) then --12;
3453: p_from_table := 'msc_supplies';
3454: p_order_type_list := c_sup_intrnst_rec;

Line 3453: p_from_table := 'msc_supplies';

3449: elsif (p_row_offset = c_row_transit) then --11;
3450: p_from_table := 'msc_supplies';
3451: p_order_type_list := c_sup_intrnst_shpmt;
3452: elsif (p_row_offset = c_row_receiving) then --12;
3453: p_from_table := 'msc_supplies';
3454: p_order_type_list := c_sup_intrnst_rec;
3455: elsif (p_row_offset = c_row_new_buy_po) then --13;
3456: p_from_table := 'msc_supplies';
3457: p_order_type_list := c_sup_new_buy_po;

Line 3456: p_from_table := 'msc_supplies';

3452: elsif (p_row_offset = c_row_receiving) then --12;
3453: p_from_table := 'msc_supplies';
3454: p_order_type_list := c_sup_intrnst_rec;
3455: elsif (p_row_offset = c_row_new_buy_po) then --13;
3456: p_from_table := 'msc_supplies';
3457: p_order_type_list := c_sup_new_buy_po;
3458: elsif (p_row_offset = c_row_new_buy_po_req) then --14;
3459: p_from_table := 'msc_supplies';
3460: p_order_type_list := c_sup_new_buy_po_req;

Line 3459: p_from_table := 'msc_supplies';

3455: elsif (p_row_offset = c_row_new_buy_po) then --13;
3456: p_from_table := 'msc_supplies';
3457: p_order_type_list := c_sup_new_buy_po;
3458: elsif (p_row_offset = c_row_new_buy_po_req) then --14;
3459: p_from_table := 'msc_supplies';
3460: p_order_type_list := c_sup_new_buy_po_req;
3461: elsif (p_row_offset = c_row_intrnl_rpr_ordr) then --15;
3462: p_from_table := 'msc_supplies';
3463: p_order_type_list := to_char(c_sup_intrnl_rpr_ordr);

Line 3462: p_from_table := 'msc_supplies';

3458: elsif (p_row_offset = c_row_new_buy_po_req) then --14;
3459: p_from_table := 'msc_supplies';
3460: p_order_type_list := c_sup_new_buy_po_req;
3461: elsif (p_row_offset = c_row_intrnl_rpr_ordr) then --15;
3462: p_from_table := 'msc_supplies';
3463: p_order_type_list := to_char(c_sup_intrnl_rpr_ordr);
3464: elsif (p_row_offset = c_row_xtrnl_rpr_ordr) then --16;
3465: p_from_table := 'msc_supplies';
3466: p_order_type_list := to_char(c_sup_xtrnl_rpr_ordr)||', '|| to_char(c_sup_ext_rep_req);

Line 3465: p_from_table := 'msc_supplies';

3461: elsif (p_row_offset = c_row_intrnl_rpr_ordr) then --15;
3462: p_from_table := 'msc_supplies';
3463: p_order_type_list := to_char(c_sup_intrnl_rpr_ordr);
3464: elsif (p_row_offset = c_row_xtrnl_rpr_ordr) then --16;
3465: p_from_table := 'msc_supplies';
3466: p_order_type_list := to_char(c_sup_xtrnl_rpr_ordr)||', '|| to_char(c_sup_ext_rep_req);
3467: --elsif (p_row_offset = c_row_inbnd_ship) then --17;
3468: --p_from_table := 'msc_supplies';
3469: --p_order_type_list := null;

Line 3468: --p_from_table := 'msc_supplies';

3464: elsif (p_row_offset = c_row_xtrnl_rpr_ordr) then --16;
3465: p_from_table := 'msc_supplies';
3466: p_order_type_list := to_char(c_sup_xtrnl_rpr_ordr)||', '|| to_char(c_sup_ext_rep_req);
3467: --elsif (p_row_offset = c_row_inbnd_ship) then --17;
3468: --p_from_table := 'msc_supplies';
3469: --p_order_type_list := null;
3470: elsif (p_row_offset = c_row_rpr_wo) then --18;
3471: p_from_table := 'msc_supplies';
3472: p_order_type_list := c_sup_rpr_wo ||', '|| to_char(c_sup_rpr_wo_ext_rep_supp) ;

Line 3471: p_from_table := 'msc_supplies';

3467: --elsif (p_row_offset = c_row_inbnd_ship) then --17;
3468: --p_from_table := 'msc_supplies';
3469: --p_order_type_list := null;
3470: elsif (p_row_offset = c_row_rpr_wo) then --18;
3471: p_from_table := 'msc_supplies';
3472: p_order_type_list := c_sup_rpr_wo ||', '|| to_char(c_sup_rpr_wo_ext_rep_supp) ;
3473: elsif (p_row_offset = c_row_plnd_new_buy_ordr) then --19;
3474: p_from_table := 'msc_supplies';
3475: p_order_type_list := c_sup_plnd_new_buy_ordr;

Line 3474: p_from_table := 'msc_supplies';

3470: elsif (p_row_offset = c_row_rpr_wo) then --18;
3471: p_from_table := 'msc_supplies';
3472: p_order_type_list := c_sup_rpr_wo ||', '|| to_char(c_sup_rpr_wo_ext_rep_supp) ;
3473: elsif (p_row_offset = c_row_plnd_new_buy_ordr) then --19;
3474: p_from_table := 'msc_supplies';
3475: p_order_type_list := c_sup_plnd_new_buy_ordr;
3476: elsif (p_row_offset = c_row_plnd_intrnl_rpr_ordr) then --20;
3477: p_from_table := 'msc_supplies';
3478: p_order_type_list := c_sup_plnd_intrnl_rpr_ordr;

Line 3477: p_from_table := 'msc_supplies';

3473: elsif (p_row_offset = c_row_plnd_new_buy_ordr) then --19;
3474: p_from_table := 'msc_supplies';
3475: p_order_type_list := c_sup_plnd_new_buy_ordr;
3476: elsif (p_row_offset = c_row_plnd_intrnl_rpr_ordr) then --20;
3477: p_from_table := 'msc_supplies';
3478: p_order_type_list := c_sup_plnd_intrnl_rpr_ordr;
3479: elsif (p_row_offset = c_row_plnd_xtrnl_rpr_ordr) then --21;
3480: p_from_table := 'msc_supplies';
3481: p_order_type_list := c_sup_plnd_xtrnl_rpr_ordr;

Line 3480: p_from_table := 'msc_supplies';

3476: elsif (p_row_offset = c_row_plnd_intrnl_rpr_ordr) then --20;
3477: p_from_table := 'msc_supplies';
3478: p_order_type_list := c_sup_plnd_intrnl_rpr_ordr;
3479: elsif (p_row_offset = c_row_plnd_xtrnl_rpr_ordr) then --21;
3480: p_from_table := 'msc_supplies';
3481: p_order_type_list := c_sup_plnd_xtrnl_rpr_ordr;
3482: elsif (p_row_offset = c_row_plnd_inbnd_ship) then --22;
3483: p_from_table := 'msc_supplies';
3484: p_order_type_list := c_sup_plnd_inbnd_ship;

Line 3483: p_from_table := 'msc_supplies';

3479: elsif (p_row_offset = c_row_plnd_xtrnl_rpr_ordr) then --21;
3480: p_from_table := 'msc_supplies';
3481: p_order_type_list := c_sup_plnd_xtrnl_rpr_ordr;
3482: elsif (p_row_offset = c_row_plnd_inbnd_ship) then --22;
3483: p_from_table := 'msc_supplies';
3484: p_order_type_list := c_sup_plnd_inbnd_ship;
3485: elsif (p_row_offset = c_row_plnd_rpr_wo) then --23;
3486: p_from_table := 'msc_supplies';
3487: p_order_type_list := c_sup_plnd_rpr_wo;

Line 3486: p_from_table := 'msc_supplies';

3482: elsif (p_row_offset = c_row_plnd_inbnd_ship) then --22;
3483: p_from_table := 'msc_supplies';
3484: p_order_type_list := c_sup_plnd_inbnd_ship;
3485: elsif (p_row_offset = c_row_plnd_rpr_wo) then --23;
3486: p_from_table := 'msc_supplies';
3487: p_order_type_list := c_sup_plnd_rpr_wo;
3488: elsif (p_row_offset = c_row_plnd_warr_ordr) then --24;
3489: p_from_table := null;
3490: p_order_type_list := null;

Line 3492: p_from_table := 'msc_supplies';

3488: elsif (p_row_offset = c_row_plnd_warr_ordr) then --24;
3489: p_from_table := null;
3490: p_order_type_list := null;
3491: elsif (p_row_offset = c_row_total_supply) then --25;
3492: p_from_table := 'msc_supplies';
3493: p_order_type_list := to_char(c_sup_intrnst_shpmt) ||','|| to_char(c_sup_intrnst_rec) ||','|| to_char(c_sup_new_buy_po) ||','||
3494: to_char(c_sup_new_buy_po_req) ||','|| to_char(c_sup_intrnl_rpr_ordr) ||','|| to_char(c_sup_xtrnl_rpr_ordr) ||','||
3495: to_char(c_sup_rpr_wo) ||','|| to_char(c_row_plnd_new_buy_ordr) ||','|| to_char(c_sup_plnd_intrnl_rpr_ordr) ||','||
3496: to_char(c_sup_plnd_xtrnl_rpr_ordr) ||','|| to_char(c_sup_plnd_inbnd_ship) ||','|| to_char(c_sup_plnd_rpr_wo)

Line 3540: p_from_table := 'msc_supplies';

3536: p_from_table := 'msc_demands';
3537: p_order_type_list := to_char(c_dmd_defc_part_dmd)||','||to_char(c_dmd_defc_plnd_part_dmd);
3538: p_part_condition := c_part_bad;
3539: elsif (p_row_offset = c_row_defc_onhand) then --37;
3540: p_from_table := 'msc_supplies';
3541: p_order_type_list := c_sup_defc_onhand;
3542: p_part_condition := c_part_bad;
3543: elsif (p_row_offset = c_row_returns) then --38;
3544: p_from_table := 'msc_supplies';

Line 3544: p_from_table := 'msc_supplies';

3540: p_from_table := 'msc_supplies';
3541: p_order_type_list := c_sup_defc_onhand;
3542: p_part_condition := c_part_bad;
3543: elsif (p_row_offset = c_row_returns) then --38;
3544: p_from_table := 'msc_supplies';
3545: p_order_type_list := c_sup_defc_returns;
3546: p_part_condition := c_part_bad;
3547: elsif (p_row_offset = c_row_defc_inbnd_ship) then --39;
3548: p_from_table := 'msc_supplies';

Line 3548: p_from_table := 'msc_supplies';

3544: p_from_table := 'msc_supplies';
3545: p_order_type_list := c_sup_defc_returns;
3546: p_part_condition := c_part_bad;
3547: elsif (p_row_offset = c_row_defc_inbnd_ship) then --39;
3548: p_from_table := 'msc_supplies';
3549: p_order_type_list := c_sup_defc_inbnd_ship;
3550: p_part_condition := c_part_bad;
3551: elsif (p_row_offset = c_row_defc_plnd_inbnd_ship) then --40;
3552: p_from_table := 'msc_supplies';

Line 3552: p_from_table := 'msc_supplies';

3548: p_from_table := 'msc_supplies';
3549: p_order_type_list := c_sup_defc_inbnd_ship;
3550: p_part_condition := c_part_bad;
3551: elsif (p_row_offset = c_row_defc_plnd_inbnd_ship) then --40;
3552: p_from_table := 'msc_supplies';
3553: p_order_type_list := c_sup_defc_plnd_inbnd_ship;
3554: p_part_condition := c_part_bad;
3555: elsif (p_row_offset = c_row_defc_transit) then --41;
3556: p_from_table := 'msc_supplies';

Line 3556: p_from_table := 'msc_supplies';

3552: p_from_table := 'msc_supplies';
3553: p_order_type_list := c_sup_defc_plnd_inbnd_ship;
3554: p_part_condition := c_part_bad;
3555: elsif (p_row_offset = c_row_defc_transit) then --41;
3556: p_from_table := 'msc_supplies';
3557: p_order_type_list := c_sup_defc_transit;
3558: p_part_condition := c_part_bad;
3559: elsif (p_row_offset = c_row_defc_rec) then --42;
3560: p_from_table := 'msc_supplies';

Line 3560: p_from_table := 'msc_supplies';

3556: p_from_table := 'msc_supplies';
3557: p_order_type_list := c_sup_defc_transit;
3558: p_part_condition := c_part_bad;
3559: elsif (p_row_offset = c_row_defc_rec) then --42;
3560: p_from_table := 'msc_supplies';
3561: p_order_type_list := c_sup_defc_rec;
3562: p_part_condition := c_part_bad;
3563: elsif (p_row_offset = c_row_total_defc_supply) then --43;
3564: p_from_table := 'msc_supplies';

Line 3564: p_from_table := 'msc_supplies';

3560: p_from_table := 'msc_supplies';
3561: p_order_type_list := c_sup_defc_rec;
3562: p_part_condition := c_part_bad;
3563: elsif (p_row_offset = c_row_total_defc_supply) then --43;
3564: p_from_table := 'msc_supplies';
3565: p_order_type_list := to_char(c_sup_defc_returns) ||','|| to_char(c_sup_defc_inbnd_ship) ||','|| to_char(c_sup_defc_onhand)
3566: ||','|| to_char(c_row_defc_plnd_inbnd_ship) ||','|| to_char(c_sup_defc_transit) ||','|| to_char(c_sup_defc_rec);
3567: p_part_condition := c_part_bad;
3568: elsif (p_row_offset = c_row_defc_pab) then --44;

Line 3646: if (p_from_table = 'msc_supplies') then

3642: sql_stmt := 'insert into msc_form_query ('||
3643: ' query_id, last_update_date, last_updated_by, creation_date, created_by,number1) '||
3644: ' select distinct '|| p_mfq_id ||', sysdate, 1, sysdate, 1, ';
3645:
3646: if (p_from_table = 'msc_supplies') then
3647: sql_stmt := sql_stmt || ' transaction_id from '|| p_from_table;
3648: elsif (p_from_table in ('msc_demands', 'msc_forecast_updates') ) then
3649: sql_stmt := sql_stmt || ' demand_id from '|| p_from_table;
3650: elsif (p_from_table = 'msc_orders_v') then

Line 3669: if (p_from_table = 'msc_supplies') then

3665: if (l_item_id_list is not null) then
3666: sql_stmt := sql_stmt || ' and inventory_item_id in ('|| l_item_id_list ||') ';
3667: end if;
3668:
3669: if (p_from_table = 'msc_supplies') then
3670: sql_stmt := sql_stmt || ' and order_type in ('|| l_order_type_list ||')';
3671: sql_stmt := sql_stmt || ' and trunc(new_schedule_date) between trunc(:l_date1) and trunc(:l_date2) ';
3672: sql_stmt := sql_stmt || ' and nvl(item_type_id, '||c_part_cond_id ||')= '|| c_part_cond_id
3673: ||' and nvl(item_type_value, '|| c_part_good ||' )= '|| l_part_condition ;

Line 3675: msc_sda_utils.println('msc_supplies '||sql_stmt);

3671: sql_stmt := sql_stmt || ' and trunc(new_schedule_date) between trunc(:l_date1) and trunc(:l_date2) ';
3672: sql_stmt := sql_stmt || ' and nvl(item_type_id, '||c_part_cond_id ||')= '|| c_part_cond_id
3673: ||' and nvl(item_type_value, '|| c_part_good ||' )= '|| l_part_condition ;
3674:
3675: msc_sda_utils.println('msc_supplies '||sql_stmt);
3676: execute immediate sql_stmt using l_date1, l_date2;
3677: elsif (p_from_table in ('msc_demands', 'msc_forecast_updates') ) then
3678: sql_stmt := sql_stmt || ' and origination_type in ('|| l_order_type_list ||')';
3679: sql_stmt := sql_stmt || ' and trunc(using_assembly_demand_date) between trunc(:l_date1) and trunc(:l_date2) ';