SQL Looping & Cognos

cbrunny

Diamond Member
Oct 12, 2007
6,791
406
126
Note: I am not a CS grad nor am I trained formally in SQL. I'm self taught primarily for query-only.

I don't understand looping in SQL. Or rather, I don't understand what I think looping is when someone says it to me. As I understand, SQL is declarative, and while apparently there are LOOP commands I'm not actually interested in those.

At work, we use IBM Cognos 10 to query a database. Cognos 10 generates SQL which is then sent to the database and data is retrieved. So, as I interpret it, SQL is the "real" query tool, with Cognos just driving it.

There's some concern that the way Cognos generates the SQL, that more complex queries with multiple queries and sub-queries may actually create some kind of looping, generating incorrect data. Cognos has a "Framework Manger" that allows the admin to specify joins between tables. Often these joins are not set up in a way that meets the required need, so I can actually create joins by making smaller queries in Cognos and joining them together in Cognos.

But Cognos ultimately has to interpret these queries and script up some SQL to send to the database. So assuming it is doing its job correctly how could there be looping? Or am I just talking nonsense?
 

sdifox

No Lifer
Sep 30, 2005
98,986
17,395
126
Haven't dealt with cognos in a while so I don't know if it has changed. But what are you doing that is causing looping? The whole point to olap is to not loop :)
 

cbrunny

Diamond Member
Oct 12, 2007
6,791
406
126
I agree! I'm just trying to better understand why/how looping could take place. It doesn't make any sense to me that it could even happen, though I'm not a CS expert as I mentioned. As far as I know, I've never done anything that has caused looping..... but still being told by our admin that my approach is not good because it can cause looping. Everytime he explains what that is I think "That doesn't make sense. That's not possible."