[PB6.5] cursor範例

 declare curd_temp cursor for 

  select a.out_no, b.part_no, isnull(b.out_qty,0), isnull(b.out_qty,0) - isnull(b.turn_qty,0), b.seq_no

from lsf130 a, lsf130s b 

where 1 = 1

  and a.proj_no = :fs_proj

  and a.cust_no = :fs_cust

//   and a.out_date <= :fs_date

  and a.out_no  = b.out_no

  and isnull(rev_qty,0)   > 0

  and isnull(confirm_emp,'') <> ''

  and isnull(cancel_date,'') = ''

order by b.part_no, a.out_no;


open  curd_temp;

fetch curd_temp into :ls_out, :ls_part, :ld_out, :ld_turn, :ls_seq_old ;

do while sqlca.sqlcode = 0

ll_count = ll_count + 1

ls_seq_no  = string( long(ls_seq_no) + 1 ,'000')

tab_1.tabpage_1.dw_3.insertrow(0)

//   wf_get_seq_2()//   tab_1.tabpage_1.tab_2.tabpage_d2.dw_d2.setitem(ll_count, "auto_no", ls_auto_no)

   tab_1.tabpage_1.dw_3.setitem(ll_count, "seq_no", ls_seq_no)

   tab_1.tabpage_1.dw_3.setitem(ll_count, "turn_qty", ld_turn)

   tab_1.tabpage_1.dw_3.setitem(ll_count, "out_no", ls_out)

   tab_1.tabpage_1.dw_3.setitem(ll_count, "part_no", ls_part)

   tab_1.tabpage_1.dw_3.setitem(ll_count, "raw_qty", ld_out )

   tab_1.tabpage_1.dw_3.setitem(ll_count, "ls_pick", 'Y')

   tab_1.tabpage_1.dw_3.setitem(ll_count, "seq_old", ls_seq_old)

fetch curd_temp into :ls_out, :ls_part, :ld_out, :ld_turn, :ls_seq_old ;

loop 

close curd_temp;


沒有留言:

張貼留言

[DataSet Bug]無法啟用條件約束。一或多個資料列的值違反非 Null、唯一或外部索引鍵條件約束

在使用TableAdapter作Query時發生 1. 原因為有些資料欄位Query出來後為null值 但是該欄位在dbDataSet的屬性AllowDBNull為False 因此把該欄位(或乾脆把全部欄位屬性AllowDBNull改為True 2. maxLength 檢...