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

if statement

Started by lporter@wsutech.edu, 21 Apr 2020 03:43:22 PM

Previous topic - Next topic

lporter@wsutech.edu

I don't understand why this doesn't work. I've used if-then-else before without a problem.

Address Type is VARCHAR2 (2) in an Oracle database. I want to create a sort key for these address types.

if ([ADDRESS_TYPE]='PA')
then 1
else
if ([ADDRESS_TYPE]='PR')
then 2
else
if ([ADDRESS_TYPE]='MA')
then 3
else 0

Parsing error before or near position 32 of "if ([ADDRESS_TYPE]='PA')
then 1"

bus_pass_man

1. The syntax is  If (  ) then () else ()
2.  Consider using a case rather than a nested IF.  It is cleaner and clearer.