gpt4 book ai didi

sql - DB2 中的意外标记 "LIMIT"

转载 作者:行者123 更新时间:2023-12-05 08:44:18 24 4
gpt4 key购买 nike

我的 Rails 应用程序连接到远程 DB2 数据库,在迁移时我遇到了这个错误:

==  DropLegacyProject: migrating ========================================
rake aborted!
An error has occurred, this and all later migrations canceled:

RuntimeError: Failed to execute statement due to: [IBM][CLI Driver][DB2/LINUXX8664] SQL0104N An unexpected token "LIMIT" was found following "". Expected tokens may include: "FETCH FIRST <n> ROWS ONLY". SQLSTATE=42601 SQLCODE=-104: SELECT projects.* FROM projects WHERE projects.id < 17 LIMIT 1

我该如何解决这个问题?

最佳答案

DB2 不支持 LIMIT x 关键字。

如错误消息所述,执行此操作的正确方法是使用 FETCH FIRST x ROWS ONLY

关于sql - DB2 中的意外标记 "LIMIT",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13183455/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com