ECDR03542 - 2019-12-21 - - Infrastructure
النوع: أضافة الحالة:منتهي العميل: معامل البركه مستقبل الشكوي: احمد قاصد تصعيد إلي: احمد قاصد الوزن النسبي: 095
وصف الطلب:

Oracle DB does not allow aliases longer than 30 characters, this creates a problem with SQLImporter entity flow that we use to do DB level integration with other systems

As a solution, we need to add special columns after columns that need a long name. As an example this is an actual details importer query for integration with NTME Lab Information Systems (LDM):

select '' ":-detail:details", r.REQUEST_ID "#description1",'1000001' "details.item.itemCode",'1000001' "details.item.item",rl.SERVICE_CODE "details.n1",rl.SERVICE_NAME "details.text1",'1' "details.quantity.quantity.primeQty.value",'101' "details.quantity.quantity.primeQty.uom",
rl.CASH_FEES "details.price.unitPrice",rl.DISCOUNT "details.price.discount1.value"
from Request_Services rl
left join Requests r on rl.REQUEST_ID = r.REQUEST_ID
where r.REQUEST_ID = '468273'

Unfortunately oracle rejects this query because the aliases details.quantity.quantity.primeQty.value, details.quantity.quantity.primeQty.uom  are too long (more than 30 characters long). The following modified query will work, we added two 'dummy' columns with an alias starting with the symbol $alias$ in its alias and the actual alias in the value, Nama will remove those pseudo columns:

select '' ":-detail:details", r.REQUEST_ID "#description1",'1000001' "details.item.itemCode",'1000001' "details.item.item",rl.SERVICE_CODE "details.n1",rl.SERVICE_NAME "details.text1",'1' "c1", 'details.quantity.quantity.primeQty.value' "$alias$1",
'101' "c2", 'details.quantity.quantity.primeQty.uom' "$alias$2",
rl.CASH_FEES "details.price.unitPrice",rl.DISCOUNT "details.price.discount1.value"
from Request_Services rl
left join Requests r on rl.REQUEST_ID = r.REQUEST_ID
where r.REQUEST_ID = '468273'

This is the interesting part in the query:

'1' "c1", 'details.quantity.quantity.primeQty.value' "$alias$1",
'101' "c2", 'details.quantity.quantity.primeQty.uom' "$alias$2",

This will be changed as if you wrote the following:

'1' "details.quantity.quantity.primeQty.value",
'101' "details.quantity.quantity.primeQty.uom"