次のスクリプトを使用して、特定の製造指図の注文履歴を取得しています。注文履歴に基づいて次の注文数を計算するOracle SQL
select ds.status, ds.catnr, ds.part_no, ds.print_type, ds.nr_discs, ds.qty, ds.ship_date
from
(select 'Open Order' status, gb.catnr, gb.part_no, decode(gb.tec_criteria,'XX','SCREEN','OF','OFFSET','PI','OFFSET','MC','OFFSET') print_type, sp.nrunits nr_discs, sum(gb.or_menge_fd) qty, min(trunc(gb.shd_date)) ship_date
from gps_beweg gb, oes_customer oc, scm_packtyp sp
where gb.part_no = 'A0101628358-VV92-1900'
and gb.uebergabe_oes = '1'
and gb.pwerk_disc = 'W'
and gb.cunr = oc.cunr
and gb.packtyp = sp.packtyp
group by gb.cunr, oc.name, gb.part_no, sp.nrunits, gb.tec_criteria, gb.catnr, gb.prodtyp, gb.packtyp
UNION ALL
select unique 'Shipped Order' status,
null catnr, null part_no, null print_type, null nr_discs,
(select sum(ds1.planqty) from oes_delsegview ds1 where ds.ordnr = ds1.ordnr and ds.catnr = ds1.catnr and ds.prodtyp = ds1.prodtyp and ds.packtyp = ds1.packtyp) qty,
(select trunc(max(ds1.gps_planshpdate)) from oes_delsegview ds1 where ds.ordnr = ds1.ordnr and ds.catnr = ds1.catnr and ds.prodtyp = ds1.prodtyp and ds.packtyp = ds1.packtyp) ship_date
from part_description pd1, oes_delsegview ds
where pd1.part_no =
(select max(gb.part_no)
from gps_beweg gb
where gb.part_no = 'A0101628358-VV92-1900'
and gb.uebergabe_oes = '1'
and gb.pwerk_disc = 'W')
and pd1.catnr = ds.catnr
and pd1.prodtyp = ds.prodtyp
and pd1.packtyp = ds.packtyp
and ds.ord_o_status in ('7','9')
order by status, ship_date desc) ds
where rownum <=5
このスクリプトの結果は次のようになります...
私は次の数量と日付を予測するQTYと列SHIP_DATE列のデータを使用したいと思います。 TREND関数を使ってExcelでこれを行うことができます。 SQLでこれを行う方法はありますか?それはREGR_SLOPE関数と一線を画していますか(これはどういうふうに頭がおかしくないのでしょうか?!)。
私が知る限り、ここであなたを助けるためにOracleのSQLには何も組み込まれていません。ただし、予測レポート機能があります(https://docs.oracle.com/cd/B28359_01/olap.111/b28126/dml_commands_1052.htm#OLADM822)。私はこれを使ったことがなく、実際に呼び出す方法はわかりません。何らかの形でこれを使用したり、エクセルなどの機能を提供するツールを使用してDBMSの外部で行うことができます。 –
フィードバックいただきありがとうございます、私は予測機能をチェックアウトします(リンクのおかげで)。私は、Excelの機能を使用することに戻る必要があるかもしれないと思う。 – SMORF