hi all
we have this requirement where if a countrycode(parameter) is specified we should get the data from the table where the countrycode column in the table matches the parameter value. if nothing is specified all the data for all the countries should be retrieved
we found this out and rote a query in my ODBC stage accordingly
select * from COMET_TEST.REFERENCETABLE where SRC_CNTRY_CD =(DECODE('#CountryCode#','',SRC_CNTRY_CD,'#CountryCode#') )
This works great i am able to achieve my objective.
but some of my tables are in informix and the same function is not working can anyone tell me the equavalent for this in informix
any inputs will be really helpful
Thanks and regards
Pavan
informix equalivalent for 'decode'statement in oracle
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 133
- Joined: Tue Nov 23, 2004 11:24 pm
- Location: India
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
-
- Premium Member
- Posts: 133
- Joined: Tue Nov 23, 2004 11:24 pm
- Location: India
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
-
- Premium Member
- Posts: 133
- Joined: Tue Nov 23, 2004 11:24 pm
- Location: India
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
DECODE can have more than two options.
Most databases' SQL has a CASE construct that you can use if there is no DECODE available.
Most databases' SQL has a CASE construct that you can use if there is no DECODE available.
Code: Select all
SELECT CASE WHEN '#CountryParameter#' = '' THEN SRC_CNTRY_CD
WHEN '#CountryParameter#' IS NULL THEN SRC_CNTRY_CD
ELSE '#CountryParameter#'
END AS CNTRY_CODE
FROM #SchemaName#.REFERENCETABLE ;
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.