網路城邦
上一篇 回創作列表 下一篇   字體:
TIPTOP讀DB時, 要有"廠區"的寫法
2017/03/08 09:54:49瀏覽528|回應0|推薦0
參考 amri500



DEFINE l_fc_plant     LIKE type_file.chr10 #FC來源廠區 

#FC來源廠區

    LET l_fc_plant = g_sma.ta_smac255

    IF cl_null(l_fc_plant) THEN LET l_fc_plant = 'TW' END IF 

    LET l_fc_plant=s_dbstring(l_fc_plant CLIPPED)



#取FCNO確認數量

    LET l_sql = "SELECT opd08,opd09,tc_opd61 ",

                " FROM ",l_fc_plant CLIPPED,"opd_file",

                " WHERE ta_opdc21 = '",g_msb[l_ac].ta_msbc43 CLIPPED,"'"

    PREPARE i500_b_read_opd_p1 FROM l_sql

    EXECUTE i500_b_read_opd_p1 INTO l_opd08,l_opd09,l_tc_opd61

    IF STATUS THEN

       .....

    END IF

    FREE i500_b_read_opd_p1



#檢查MPS備註為空,則帶入FCNO備註

    IF l_n = 0 THEN

       INITIALIZE l_tc_msoc.* TO NULL

       LET l_tc_msoc03 = 0 #備註序號重排

       LET l_sql="SELECT oao01,oao03,oao04,oao06 FROM ", l_fc_plant CLIPPED,"oao_file",

                 " WHERE oao01='",g_msb[l_ac].ta_msbc43 CLIPPED,"' and oao04 < 90 order by 1,2,3" 

       PREPARE oao_pre1 FROM l_sql

       DECLARE oao_cs1 CURSOR FOR oao_pre1

       FOREACH oao_cs1 INTO l_tc_msoc.*

          LET l_tc_msoc.tc_msoc01 = g_msa.msa01

          LET l_tc_msoc.tc_msoc02 = g_msb[l_ac].msb02

          LET l_tc_msoc03 = l_tc_msoc03 + 1

          LET l_tc_msoc.tc_msoc03 = l_tc_msoc03

          INSERT INTO tc_msoc_file VALUES (l_tc_msoc.*)

       END FOREACH

    END IF                              
( 知識學習其他 )
回應 推薦文章 列印 加入我的文摘
上一篇 回創作列表 下一篇

引用
引用網址:https://classic-blog.udn.com/article/trackback.jsp?uid=shfm1969&aid=94890000