13带更新的游标

/*可更新的游标
  current of 游标名:表示游标的当前行。
  当使用游标更新或删除数据时,在定义游标时必须要带有for update子句,
  用于在游标结果集数据上加行共享锁,以防止其他用户在相应行上执行dml操作;
*/

declare
  cursor cs_user is
    Select * From T_userinfo for update;
begin
  for v_row in cs_user loop
    if v_row.userid = 6 then
      --null;
      update T_Userinfo
         set username = '可更新游标'
       where current of cs_user;
    else
      if v_row.userid =  7 then
        delete From T_userinfo where current of cs_user;
      end if;
    end if;
  end loop;
  commit;
end;

 --可更新的游标在jdbc中的使用。
 
 --Select * From T_userinfo for update of username;
 
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
def refresh_labels(self): data4 = self.la # 连接到 SQLite 数据库文件,并创建游标对象 cursor() conn = sqlite3.connect(filepath) cursor = conn.cursor() data41 = str(self.la) if not data4.endswith('.xlsx'): data4 += '.xlsx' wo = pinjie filepath = os.path.join(wo, data4) if not os.path.exists(filepath): wb = openpyxl.Workbook() wb.save(filepath) else: wb = openpyxl.load_workbook(filepath) for i, sheet_name in enumerate(self.sheet_names): label = tk.Label(self.unique_listbox, text=sheet_name) label.grid(row=i // 3, column=i % 3, sticky="ew", padx=1, pady=1) current_time = datetime.datetime.now().time() start_time_1 = datetime.time(8, 0, 0) # 早上8点 end_time_1 = datetime.time(20, 0, 0) # 下午7点 start_time_2 = datetime.time(20, 0, 0) # 晚上8点 end_time_2 = datetime.time(7, 0, 0) # 早上7点 for i, sheet_name in enumerate(self.sheet_names): filtered_rows = [] # 优化第二段代码:检查文件是否存在 filepath = os.path.join(pinjie, self.la + '.xlsx') if os.path.exists(filepath): workbook = xl.load_workbook(filepath) sheet = workbook.active today = datetime.datetime.now().strftime('%Y/%m/%d') cell_value = sheet.cell(row=1, column=1).value if cell_value is not None and cell_value != '': for row in sheet.iter_rows(min_row=1): if row[2].value == today and row[8].value == sheet_name: datetime_obj = datetime.datetime.strptime(row[3].value, '%H:%M:%S') row_time = datetime_obj.time() if start_time_1 <= row_time <= end_time_1 and start_time_1 <= current_time <= end_time_1: filtered_rows.append(row) elif start_time_2 <= row_time or current_time <= end_time_2: filtered_rows.append(row) label = self.unique_listbox.grid_slaves(row=i // 3, column=i % 3)[0] if filtered_rows: label.config(text=f"{sheet_name} - 已點檢", fg="green") else: label.config(text=f"{sheet_name} - 未點檢", fg="red")什麽意思
最新发布
07-14

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值