I am trying to fetch records from mainframe table using spark sql context with the below query
data_config.db2_qry= SELECT A.E_No,A.E_Name FROM Scheema.Employee A WITH UR
but it is throwing the below error
com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-199, SQLSTATE=42601, SQLERRMC=WITH;HAVING WHERE GROUP ORDER INTERSECT MINUS EXCEPT UNION ) , FETCH, DRIVER=4.19.26
but if I run the same query in mainframe console directly it works fine.
How to use WITH clause in sql context of spark?
I am using spark version 2.4.0
I am retrieving the records like below
filt_cond = "(" + data_config.db2_qry + ") ref_id"
db2Df = sqlContext.read.format("jdbc").option("url", data_config.db2_url).option("driver", "com.ibm.db2.jcc.DB2Driver").option( "dbtable", filt_cond).option("user", data_config.db2_uname).option("password", data_config.db2_passwd).load()