Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Can you use "If..Then" logic in SQL?

Re: Can you use "If..Then" logic in SQL?

From: <jeff109_at_NOSPAM.netscape.net>
Date: Thu, 06 May 1999 16:47:56 GMT
Message-ID: <3731c646.11033094@news>


I think you're thinking of FoxPro's immediate IF here. In SQL, you would use DECODE(value, if1, then1, [if2,then2,...] else).

-Jeff Guttadauro

On Tue, 4 May 1999 15:14:32 +0200, "simone" <simone_vola_at_yahoo.com> wrote:

>In the SQL statement doesn't exist IF..then, but you can use
>iif(condition;right result; wrong result)
>Mitch ha scritto nel messaggio <7ganjk$de6$1_at_news.doit.wisc.edu>...
>>
>>
>>-- I am programming a VB app that pulls data from an Oracle 8 database into
>>Access for further manipulation. I am trying to figure out if there is a
>>way using either Oracle or Jet SQL to use "If..Then" logic in my SQL query.
>>For example,
>>
>>"Select Table1.*, Table2.* where Table1.Key = Table2.Key (this is where I'm
>>not sure about the syntax) and If Table2.Price and Table2.Date are NULL
>then
>>Table1.Price, Table1.Date Else Table2.Price and Table2.Date"
>>
>>I am sure I could just pull all records from the Oracle database into
>Access
>>and then use DAO methods to create another recordset that meets the above
>>criteria, but that's bound to be very slow. I'd like to use strictly SQL
>if
>>possible. Any and all suggestions (Oracle, Access or VB) are appreciated.
>>
>>Thanks
>>
>>Mitch Abaza
>>mabaza25_at_DELETEusa.net
>>
>>clear "delete" to mail
>>
>>
>>
>
>
Received on Thu May 06 1999 - 11:47:56 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US