Hi guys,
I have a general programming question that maybe relates to load handling.
Given a choice, which one should be preferred? A Case statement or an If/Then/Else logic? Is there more processing involved in one or the other, or is it the same for both?
Thanks
Hard to tell. In fact, the expressions you define are used by the server's UDA to compile the proper SQL syntax for the database you are addressing. So , in fact the 'IF THEN ELSE' would probably make some sense with SQL servers T-sql. However, non-procedural SQL in other databases need to work with CASE statements , cause outside procedures the SQL compiler can't work with If Then Else.
Bottom-line: CASE is more generic, UDA will recompile (all) the COgnos SQL at runtime and I doubt there will be much of a difference.
I haven't seen a (performance) difference in my experience; my rule of thumb is to use CASE just for readability whenever the condition would require nesting IFs.