Uploaded image for project: 'Teiid'
  1. Teiid
  2. TEIID-3673

Subquery field with limit giving a wrong JDBC SQL in Oracle

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 8.12
    • 8.0
    • JDBC Connector
    • None

      i'm executing the following query using Teiid 8.11.3 and Oracle translator:

      select "Trx_LjM_030915"."CID" as "Trx_LjM_030915_CID"
      ,"Trx_LjM_030915"."TransactionDate" as "Trx_LjM_030915_TransactionDa"
      ,(select "Trx_LjM_030915_sub"."TransactionDate" as "Trx_LjM_030915_TransactionDa"
      from "AUDIDATA_SCHEMANAME_MODEL"."AUDIDATA_SCHEMANAME"."Trx_LjM_030915" "Trx_LjM_030915_sub"
      where ("Trx_LjM_030915"."CID" = "Trx_LjM_030915_sub"."CID")
      AND ( ("Trx_LjM_030915_sub"."TransactionDate" < "Trx_LjM_030915"."TransactionDate") )
      order by "Trx_LjM_030915_sub"."TransactionDate" DESC
      LIMIT 0 , 1) as "SubQuery Trx"
      from "AUDIDATA_SCHEMANAME_MODEL"."AUDIDATA_SCHEMANAME"."Trx_LjM_030915" "Trx_LjM_030915" LIMIT 0 , 10

      And i'm getting this error:

      Error TEIID30504 AUDIDATA_SCHEMANAME_MODELVDB: 904 TEIID11008:TEIID11004 Error executing statement(s): [Prepared Values: [] SQL: SELECT c_0, c_1, c_2 FROM (SELECT g_0."CID" AS c_0, g_0."TransactionDate" AS c_1, (SELECT c_0 FROM (SELECT g_1."TransactionDate" AS c_0 FROM "AUDIDATA_SCHEMANAME"."Trx_LjM_030915" g_1 WHERE g_1."CID" = g_0."CID" AND g_1."TransactionDate" < g_0."TransactionDate" ORDER BY c_0 DESC) WHERE ROWNUM <= 1) AS c_2 FROM "AUDIDATA_SCHEMANAME"."Trx_LjM_030915" g_0) WHERE ROWNUM <= 10

      You can notice g_0."CID" and g_0."TransactionDate" in the where condition are no longer valid in the Teiid generated JDBC SQL; Since they do not exist in the parent query.

      Note that the same case works fine with H2 and mysql

            rhn-engineering-shawkins Steven Hawkins
            mtawk Mark Tawk (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: