熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Oracle >> 正文

rowscopy, 拷貝帶有自增字段的表

2022-06-13   來源: Oracle 

  清除本地數據
  
  ls_sql = TRUNCATE TABLE + ls_table []
   execute IMMEDIATE :ls_sql using sqlca;
  
  //打開可以插入自增顯示插入自增字段的值
  
   ls_sql = SET IDENTITY_INSERT + ls_table [] + on
   execute IMMEDIATE :ls_sql using sqlca;
  
  構造數據窗口或datastore
  
  wf_set_iden_off_(dw_) //關掉本地datastore的自增

  
  wf_set_iden_off_內容:
  
  //將指定datastore 的自增字段設置為 off
  
  string ls_colcount
  long ll_colcount i
  string ls_ColName
  
  ls_colcount = ar_dsDescribe(DataWindowColumnCount)
  
  if integer (ls_colcount) > then
   ll_colcount = integer (ls_colcount)
  else
   return
  end if
  
  string ls_on ls_err
  
  for i = to ll_colcount
   ls_ColName = ar_dsDescribe(# + string(i) +name)
   ls_on = ar_dsDescribe(# + string(i) +Identity)
   if ls_on = yes then
  ar_dsmodify (ls_ColName + Identity = no )
   end if
  next
  
  開始copy
  
  update

  
  結束
From:http://tw.wingwit.com/Article/program/Oracle/201311/16525.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.