Link to home
Start Free TrialLog in
Avatar of janthonyn
janthonyn

asked on

Need help converting SQL Syntax from Oracle to Access SQL

I have to define a column in an Access query conditionally. I can't use the DECODE function, but I don't know the Access equivalent. Here's what the portion of the SQL would look like if I could use DECODE:

decode(pc.PAYOR_STATUS
         ,'Medicare','Medicare/MngCare'
         ,'Managed Care','Medicare/MngCare'
         ,'MGDCARE','Medicare/MngCare'
          ,'Other') as PPD_payor
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

What does DECODE do in Oracle ?

mx
ASKER CERTIFIED SOLUTION
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
MX,

I didn't know either, until I read this:

http://www.techonthenet.com/oracle/functions/decode.php

:)

Patrick
Yeah, I suppose I should have Googled that :-)

mx
janthonyn,

Basic syntax for IIf:

IIf(<logical expression>, <expression if true>, <expression if false>)

You can nest IIf expressions, but doing that can quickly make your SQL undecipherable (just like
nesting multiple levels of IF expressions in Excel makes things difficult to unravel).

Regards,

Patrick
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial