For partners that build or integrate commercially available applications and service solutions with the Oracle Cloud Platform
For partners that provide implementation or managed services around Oracle Cloud Applications
Hi experts,
In integration we are reading one file which has multiple lines, after that we want to call a DB procedure for each line(line value as input parameter or procedure).
One way is in integration we use For Each action and call the procedure within the loop
The other way looks to be during mapping, add for-each(mapping readfile lines) at the top of procedure call request
Will they behave the same? Is that the 1st one will call DB agent multiple times but the 2nd one will only call DB agent once?
Suppose there are 20000 records from source file, which one would be better?
The procedure here we want to use is to update one DB table based on the input records.
Thanks in advance!
Comment
The difference is scope (execution scope):
With respect which one is best depends on the DB procedure. If the DB procedure accepts multiple records in the payload, then use Map to create the payload having multiple records. If the DB procedure only accepts one record at the time, then use the For-Each Action and within the body of the For-Each Action invoke the DB procedure. The Invoke will require you to create a map (build the payload). In the Map select the record from the For-Action definition.
Average Rating:



1 rating
|
Sign in to rate this
Hi Jorge,
Thanks for the elaboration, i've prepared a screenshot to explain the for-each within mapping. i am not saying call procedure in mapping, just want to know if there is any advantage to use for-each in mapping instead of wrapping DB procedure call within Integration For-Each action
Be the first to rate this
|
Sign in to rate this
Be the first to rate this
|
Sign in to rate this
Not sure how to add multiple pics in one post...
below is the Integration For-Each action i am saying. i believe like this the DB adapter procedure call will be trigger multiple times for each source data record.
But if we do it like the first picture, will it be any difference? Or it won't work at all unless the procedure accepts table record input parameter? Because i am using sql server DB, looks OIC does not support table records to be passed in as parameter for it.
Thanks
Be the first to rate this
|
Sign in to rate this
This is they way you need to go: ForEach created in the Orchestration level.
Now, to do the map (XSLT), you want to map the values from the variable that you defined in the forEachGLJournallm under the Current Element Name ... You'll see it in the Map editor starting with a $ then the name you provided for the "Current Element Name" field. Map from that variable/parameter and that's it.
The for-loop will pickup a record at the time from the input payload and put it in the $ var of the for-each. The map will take the values from the $var for each and send them to the DB.
Be the first to rate this
|
Sign in to rate this
Ok, now I'm clear what you are asking.
Definitely you do not want to go this route (having a <xsl:for-each> in the Map (XSLT). Reason being, the Target is not unbounded (repeated). The target only accepts 1 "record" a the time.
BTW - just for fun, click the TEST button, generate a payload and run your mapping. You'll see the odd results on the map... Do not worry, the DB will not be called by this TEST, it will only run the XSLT in memory and show you the result.... again, just for fun.
Be the first to rate this
|
Sign in to rate this