val cor = TCorridor.slice(corridorNm).select{
TCorridor.corridorId eq TFlightPathSegment.corridorId
}
val corPo = TCorridorPoint.slice(pointNm).select{
TCorridorPoint.pointId eq TFlightPathSegment.pointId
}
val pNm = SubQueryExpression<String>(corPo.alias(""))
val cNm = SubQueryExpression<String>(cor.alias(""))
The reason why the alias is blank is that the alias is attached after the subquery in the case statement, causing an error.
val typeNm =
Expression.build {
case()
.When((TFlightPathSegment.fltPathType eq "POINT"), pNm)
.Else(cNm)
}
val query = TFlightPathSegment
.slice(TFlightPathSegment.fltPathId, TFlightPathSegment.sortOrd, TFlightPathSegment.fltPathType, TFlightPathSegment.pointId, TFlightPathSegment.corridorId
, typeNm
).select { TFlightPathSegment.fltPathId eq fltPathId1 }
.groupBy(TFlightPathSegment.fltPathId, TFlightPathSegment.sortOrd)
.orderBy(TFlightPathSegment.sortOrd)
The sql of the variable name query is output normally. Get the value of each field using query.map{}
query.map {
println("case1 ---------- ")
println(it) // if print it ↓
it = TFlightPathSegment.fliPathId = "", TFlightPathSegment.sortOrd = "", CASE WHEN TFlightPathSegment.fltPathType = "POINT" THEN (SELECT POINT_NM FROM TCorridorPoint where point_id = TFlightPathSegment.flt) = "POINT_NM"
}
I want to get the value returned from the case statement
if print it[typeNm] returned boolean Type but i want return value of subquery by condition What am I missing?