dbTalk Databases Forums  

Condition in SQL

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss Condition in SQL in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
francan00@yahoo.com
 
Posts: n/a

Default Condition in SQL - 11-27-2007 , 09:35 PM






I have this query with a condition in Access and would like to know
how I can put a condition part in Oracle 9i SQL similiar to how Access
does it?


Current Access SQL that I want to rewrite in Oracle where I just need
to know how to do the condtion part: IIF( ISNULL(d.NOTES)=True,'Not
Available',d.NOTES) AS NOTES


SELECT
b.FirstName,
b.LastName,
c.FirstName,
c.LastName,
a.Info,
IIF( ISNULL(d.NOTES)=True,'Not Available',d.NOTES) AS NOTES
FROM
Person AS b,
Person AS c,
Notes AS d,
Main AS a
WHERE
a.MID= 34
And
b.PID=a.PO
And
c.PID=a.TE
And
d.MID=a.MID


Reply With Quote
  #2  
Old   
Ana C. Dent
 
Posts: n/a

Default Re: Condition in SQL - 11-27-2007 , 09:40 PM






francan00 (AT) yahoo (DOT) com wrote in news:b133ed52-4246-4363-92f0-62472dd44353
@d27g2000prf.googlegroups.com:

http://www.orafaq.com/forum/t/93239/74940/

Reply With Quote
  #3  
Old   
DA Morgan
 
Posts: n/a

Default Re: Condition in SQL - 11-27-2007 , 10:03 PM



francan00 (AT) yahoo (DOT) com wrote:
Quote:
I have this query with a condition in Access and would like to know
how I can put a condition part in Oracle 9i SQL similiar to how Access
does it?


Current Access SQL that I want to rewrite in Oracle where I just need
to know how to do the condtion part: IIF( ISNULL(d.NOTES)=True,'Not
Available',d.NOTES) AS NOTES


SELECT
b.FirstName,
b.LastName,
c.FirstName,
c.LastName,
a.Info,
IIF( ISNULL(d.NOTES)=True,'Not Available',d.NOTES) AS NOTES
FROM
Person AS b,
Person AS c,
Notes AS d,
Main AS a
WHERE
a.MID= 34
And
b.PID=a.PO
And
c.PID=a.TE
And
d.MID=a.MID
Look at the NVL and NVL2 functions.

www.psoug.org
click on Morgan's Library
click on Built-in functions near the top of the page.
--
Daniel A. Morgan
Oracle Ace Director & Instructor
University of Washington
damorgan@x.washington.edu (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org


Reply With Quote
  #4  
Old   
sybrandb@hccnet.nl
 
Posts: n/a

Default Re: Condition in SQL - 12-02-2007 , 10:03 AM



On Tue, 27 Nov 2007 19:35:41 -0800 (PST), francan00 (AT) yahoo (DOT) com wrote:

Quote:
I have this query with a condition in Access and would like to know
how I can put a condition part in Oracle 9i SQL similiar to how Access
does it?


Current Access SQL that I want to rewrite in Oracle where I just need
to know how to do the condtion part: IIF( ISNULL(d.NOTES)=True,'Not
Available',d.NOTES) AS NOTES


SELECT
b.FirstName,
b.LastName,
c.FirstName,
c.LastName,
a.Info,
IIF( ISNULL(d.NOTES)=True,'Not Available',d.NOTES) AS NOTES
FROM
Person AS b,
Person AS c,
Notes AS d,
Main AS a
WHERE
a.MID= 34
And
b.PID=a.PO
And
c.PID=a.TE
And
d.MID=a.MID

nvl(d.notes, 'Not available')

You can find all functions in the SQL reference manual.

--
Sybrand Bakker
Senior Oracle DBA


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.