Home > Blockchain >  Column ( ) not found in any table in the query (or SLV is undefined). SQLCODE=-217
Column ( ) not found in any table in the query (or SLV is undefined). SQLCODE=-217

Time:10-14

I am reading a table from like this:

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())

But I get this error:

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;]

Is it possible to further debug which is the exact col that's causing an issue? Because otherwise, all col names seem to exist in the dataset.

CodePudding user response:

Kind of a guess because I can't see your database, but this line:

posnr[10,10] = " "

is suspect to me. At least in Postgres, double quotes indicate column names, which would give you an error like this. I would suggest replacing any double quotes intended to represent strings with single quotes and try again. ie)

posnr[10,10] = ' '
  • Related