Re: decode function in ingres

From: Chris Simon <c.simonuninstall_at_windowsbangor.ac.uk>
Date: Tue, 18 Feb 2003 11:32:35 +0000
Message-ID: <3E5219D3.7050201_at_windowsbangor.ac.uk>


krishna wrote:
> Is there any function in Ingres which in equivalent to Decode function
> in oracle. all I want to do is print 'Y' for 1 and 'N' or 0. any
> function for this purpose?

You can use either charextract or shift - these both return character results and take a numeric argument and a target string. If you can evaluate your condition to a number then you can 'perform arithmetic' on the string to return what you want!

e.g.

charextract('NY',parameter+1)
shift('NY',parameter)

shift can return more than one character so it's useful for when you want to return, say "Yes" or "No" instead of Y or N,

e.g.

shift('YesNo',parameter*3)

-- 
Chris Simon,
Analyst/Programmer,
Prifysgol Cymru Bangor - University of Wales Bangor

** Uninstall Windows to reply **
Received on Tue Feb 18 2003 - 12:32:35 CET

Original text of this message