If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Case or If/Then - Generic Question

Started by Arsenal, 16 May 2008 11:25:11 AM

Previous topic - Next topic

Arsenal

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

blom0344

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.

almeids

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.