diff --git a/ndc-connector-oracle/src/main/kotlin/io/hasura/oracle/JSONGenerator.kt b/ndc-connector-oracle/src/main/kotlin/io/hasura/oracle/JSONGenerator.kt index 69784c3..5171f27 100644 --- a/ndc-connector-oracle/src/main/kotlin/io/hasura/oracle/JSONGenerator.kt +++ b/ndc-connector-oracle/src/main/kotlin/io/hasura/oracle/JSONGenerator.kt @@ -85,8 +85,15 @@ object JsonQueryGenerator : BaseQueryGenerator() { DSL.jsonEntry( alias, - DSL.select( - subQuery.asField(alias) + DSL.coalesce( + DSL.select( + subQuery.asField(alias) + ), DSL.jsonObject( + DSL.jsonEntry( + "rows", + DSL.jsonArray().returning(SQLDataType.CLOB) + ) + ).returning(SQLDataType.CLOB) ) ) } @@ -286,7 +293,7 @@ object JsonQueryGenerator : BaseQueryGenerator() { ) private fun getTableName(collection: String): String { - return collection.split('.').last() + return collection.split('.').last() } }