Start a new topic

Case statement in ingestion to xDM

 I am trying to ingest Date from a flat csv file to xDM database. The database is MSSQL.

I can use a hard coded case statement ie (case when 1 = 1 then 1 else 0 end ) but when I try to add a variable from the flat file it gives me an error ie ( case when Flat_file.record = 'ok' then 1 else 0 end )  it gives me an error 


java.lang.ClassCastException: class net.sf.jsqlparser.expression.CaseExpression cannot be cast to class net.sf.jsqlparser.schema.Column (net.sf.jsqlparser.expression.CaseExpression and net.sf.jsqlparser.schema.Column are in unnamed module of loader com.indy.engine.core.module.classloader.StambiaClassLoaderRegistry$NamedURLClassLoader @7a79be86)
    at com.stambia.jdbc.driver.file.FileDriverStatement.verifySQLWithMetadata(FileDriverStatement.java:300)
    at com.stambia.jdbc.driver.file.FileDriverStatement.executeSelect(FileDriverStatement.java:468)
    at com.stambia.jdbc.driver.file.FileDriverStatement.executeStatement(FileDriverStatement.java:388)
    at com.stambia.jdbc.driver.file.FileDriverStatement.executeQuery(FileDriverStatement.java:512)
    at com.indy.engine.actionCodes.JdbcActionCodeI$1.initResultSet(JdbcActionCodeI.java:938)
    at com.indy.engine.manager.ActionCodeExecutor.executeDirectBindedCode(ActionCodeExecutor.java:374)
    at com.indy.engine.manager.ActionCodeExecutor.executeBindedCode(ActionCodeExecutor.java:551)
    at com.indy.engine.manager.ActionCodeExecutor.executeCode(ActionCodeExecutor.java:134)
    at com.indy.engine.manager.ActionCodeExecutor.run(ActionCodeExecutor.java:284)
    at java.base/java.lang.Thread.run(Thread.java:842)


Does anyone have a solution

1 Comment

Hello Nathan,


For this case, you can perform a SQL CASE statement direcrly.

You should use a stage between your file and the target table and perform the CASE SQL statement on the target table.

Login to post a comment