db2 在查询的任何表中都找不到列()(或未定义SLV),SQLCODE=-217

t98cgbkg  于 2022-11-07  发布在  DB2
关注(0)|答案(1)|浏览(375)

我从这样一张表上阅读到:

query = (
"select mandant,posnr,systemdat,
"lieferbedingung,loeschhafen,bereich," 
"nrkreis_nr from eakopf_t where posnr[10,10] = \" \" and posnr[1,2] not in (\"99\",\"RE\",\"UB\") and mandant <> 999;"
)

df = pd.read_sql(query, engine.connect())

但我得到这个错误:

ibm_db_dbi::DatabaseError: SQLNumResultCols failed: [IBM][CLI Driver][IDS/UNIX64] Column ( ) not found in any table in the query (or SLV is undefined). SQLCODE=-217
[SQL: select mandant,posnr,systemdat,lieferbedingung,loeschhafen,bereich,nrkreis_nr from eakopf_t where posnr[10,10] = " " and posnr[1,2] not in ("99","RE","UB") and mandant <> 999;]

是否可以进一步调试导致问题的确切列?因为否则,所有列名称似乎都存在于数据集中。

ctehm74n

ctehm74n1#

因为我看不到你的数据库,所以只能猜测,但这一行:

posnr[10,10] = " "

至少在Postgres中,双引号表示列名称,这会给予你一个类似这样的错误。我建议用单引号替换任何表示字符串的双引号,然后再试一次。

posnr[10,10] = ' '

相关问题