不要小看对数据库的操作,一个update引起的悲哀

update dbtable for internal_table

notes:if the internal table is empty except primary key,the respective record in table wil be updated emply ,except primary key.

When an internal table itab is specified, the system processes all the rows of the internal table in accordance with the rules for the work area wa. The row type of the internal table must meet the requirements for use in Open-SQL statements. If, in the database, there is no row with the same content of the primary key for a row in the internal table, or if the change would lead to a double entry in a unique secondary key, the respective row is not changed and sy-subrc is set to 4. If the internal table is empty, sy-subrc is set to 0. The system field sy-dbcnt is always set to the number of rows actually inserted.

 

GUI_UPLOAD 函数,filetype 为 'DAT',文件为以 tab键分割的文本文件(txt文件).

 

通过本次事故,以后的工作建议如下:

1,对数据库操作的DML语句,要十分小心,自己要多测试几遍.

2,变更自己严格按照变更执行计划完成,有异议和好的建议,争得需求方的同意,并有文档记录可查.

3,也要求需求方遵守流程.

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
可以使用辗转相除法和最小公倍数的性质来解决这个问题。具体步骤如下: 1. 定义一个函数 gcd(a, b),用于求两个数 a 和 b 的最大公约数。可以使用辗转相除法来实现。 2. 定义一个函数 lcm(a, b),用于求两个数 a 和 b 的最小公倍数。根据最小公倍数的定义,它等于 a 和 b 的乘积除以它们的最大公约数,即 lcm(a, b) = a * b / gcd(a, b)。 3. 对于输入的 n,从 1 到 n 依次计算它们的最小公倍数,每次计算都将结果保存下来。具体来说,可以使用一个变量 ans 来记录当前的最小公倍数,初始值为 1,然后对于每个 i(1 <= i <= n),更新 ans 为 lcm(ans, i)。 4. 最后返回 ans,即为 1~n 的最小公倍数。 下面是 Python 代码实现: ```python def gcd(a, b): """求两个数的最大公约数""" while b: a, b = b, a % b return a def lcm(a, b): """求两个数的最小公倍数""" return a * b // gcd(a, b) def smallest_lcm(n): """求1~n的最小公倍数""" ans = 1 for i in range(1, n+1): ans = lcm(ans, i) return ans # 测试 print(smallest_lcm(10)) # 输出 2520 print(smallest_lcm(20)) # 输出 232792560 print(smallest_lcm(100)) # 输出 69720375229712477164533808935312303556800 ``` 注意,当 n 很大时,最小公倍数可能会超出 Python 的整数范围,导致计算结果不正确。这时可以使用 Python 中的 Decimal 类型来避免这个问题。例如,将最小公倍数的计算结果存储在一个 Decimal 对象中,每次更新时也需要使用 Decimal 类型的 lcm 函数来计算。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值