cancel
Showing results for 
Search instead for 
Did you mean: 

How can I test for no rows back from Oracle query

vincenr
New Contributor III

I am trying to figure out how to route to a ‘no data’ path when nothing is returned from my select query. Can someone help me out?

image

What I’ve tried is (in ‘Is there data?’ snap): $retval != null (then go to data path); otherwise, go to nodata path. But I’m guessing since the select didn’t return anything, there is no $retval to look at (catch22).

I also tried:

image

17 REPLIES 17

vincenr
New Contributor III

Quick question about the first two snaps in my pipeline (Oracle Execution and the mapper snap), if there is more than one row of results in the ‘Select’ query, how does snapLogic decide which value to assign to ‘AUDIT_COUNT’ in the mapper snap? Because my comparison in the ‘Is there data’ router looks to see what the value is… if it’s not zero, it executes the upper pipeline; if it’s zero, it executes the lower pipeline. So far it’s working, but I’m not sure if it’s because it just takes ‘AUDIT_COUNT’ from the first row of results, which will either be zero if the dummy record is the only row, or something other than zero if there are any other rows (ex: AUDIT_COUNT is 2 or 5 etc).

image

image

image

vincenr
New Contributor III

But will the $ = {} work if my router snap has a mapper snap and pipeline execution snap in between it and the Oracle Execute?

vincenr
New Contributor III

Ok, so I changed the pipeline to compare $ = {} but it’s not working for me.

image.png

image.png

vincenr
New Contributor III

Sorry, this is what I changed it to which would be the correct logic for my case:

image.png

image.png

image.png

vincenr
New Contributor III

But the main thing I’d like to know is how does snapLogic decide behind the scenes how to populate AUDIT_COUNT with the pipeline I pasted above? Does it use the count from the first row in the returned rows or what does it do?

image.png

image.png

image.png