gpt4 book ai didi

sql - 现有 DB2 列报告为不是表的列

转载 作者:行者123 更新时间:2023-12-03 07:01:14 31 4
gpt4 key购买 nike

在 DB2 上运行的 Moodle 2 安装中,删除用户不成功,返回从数据库读取错误:

Debug info: [IBM][CLI Driver][DB2/LINUXX8664] SQL0206N "USERIDFROM" is not valid in the context where it is used. SQLSTATE=42703 SQLCODE=-206 SELECT * FROM mdl_message WHERE useridfrom = ? ORDER BY timecreated
[array ( 0 => '28521', )]

SQL0206N的错误描述很清楚,但是 useridfrommdl_message 的一列:

$ db2 describe table mdl_message

Data type Column
Column name schema Data type name Length Scale Nulls
------------------------- --------- ------------------- ---------- ----- ------
 ID SYSIBM BIGINT 8 0 No
 USERIDFROM SYSIBM BIGINT 8 0 No
 USERIDTO SYSIBM BIGINT 8 0 No
 SUBJECT SYSIBM VARCHAR 200 0 Yes
 FULLMESSAGE SYSIBM VARCHAR 200 0 Yes
 FULLMESSAGEFORMAT SYSIBM SMALLINT 2 0 Yes
 FULLMESSAGEHTML SYSIBM VARCHAR 100 0 Yes
 SMALLMESSAGE SYSIBM VARCHAR 200 0 Yes
 NOTIFICATION SYSIBM SMALLINT 2 0 Yes
 CONTEXTURL SYSIBM VARCHAR 200 0 Yes
 CONTEXTURLNAME SYSIBM VARCHAR 200 0 Yes
 TIMECREATED SYSIBM BIGINT 8 0 No

12 record(s) selected.

还有什么可能导致此错误?

最佳答案

列名中可能有空格。您可以使用此查询来查明是否有任何尾随空格:

db2 "select '<' || name || '>' from sysibm.syscolumns where tbname = 'MDL_MESSAGE'"

关于sql - 现有 DB2 列报告为不是表的列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11104267/

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