While creating a new Adapter service connection, I select a DynamicSQL template and create it. In that , 2 parameters are passed at run time. I’ve defined them also.
A dynamic SQL is for passing whole parts of SQL which are generated at runtime. For passing parameters you do not need to us dynamic SQL. Select a standard SQL template (select, insert, update) and just define the required inputs in the where or insert clause. This Way the required signature of the service is generated automatically. For complex SQL you may use custom SQL.
P.S.: Please post you questions to the appropriate forums, this here is just the welcome and introdtuction, not for technical questions.
Can we make a dynamic sql adapter template which takes in 2 inputs one is the actual variable value and the other one would be a dynamic variable name…
example below:
select is_freight from s_equipment se INNER JOIN shipment_s_equipment_join ssej ON ssej.s_equipment_gid = se.s_equipment_gid
where ssej.${stop_type} = ? and ssej.shipment_gid = ?
inputs:
stop_type
stop_num
shipment_gid
values
DROPOFF_STOP_NUM
6
XYZ
Expected result:(SQLStatement)
select is_freight from s_equipment se INNER JOIN shipment_s_equipment_join ssej ON ssej.s_equipment_gid = se.s_equipment_gid
where ssej.DROPOFF_STOP_NUM = ‘6’ and ssej.shipment_gid = ‘XYZ’
Getting Error:
(99999/17003) Invalid column index"
Invalid column index
select is_freight from s_equipment se INNER JOIN shipment_s_equipment_join ssej ON ssej.s_equipment_gid = se.s_equipment_gid
where ssej.${stop_type} = ${VALUE1} and ssej.shipment_gid = ${VALUE2}
Just did a small change and now its working for me…
Earlier i’ve used three input feilds, but for dynamic variables there is no need to define inputs as ‘VARCHAR’ or something else. The Adapter template by default adds dynamic inputs to input document type like (stop_type) here…which can be substituted with PICKUP_STOP_NUM or DROPOFF_STOP_NUM
So now i’ve changed the other two variables to regular types and defined only first one as dynamic(stop_type)
inputs:
stop_num
shipment_gid
select is_freight from s_equipment se INNER JOIN shipment_s_equipment_join ssej ON ssej.s_equipment_gid = se.s_equipment_gid
where ssej.${stop_type} = ? and ssej.shipment_gid = ?
Yes, in general we don’t give input, output datatype details as part of dynamic SQL’s. Going forward when you are reporting any issue, kindly attach snapshots which gives us some clarity, we can also better assist. Thanks anyways for fixing the issue.