Home » SQL & PL/SQL » SQL & PL/SQL » How to user IF ELSE in Oracle 8i SQL? (Oracle 8i)
How to user IF ELSE in Oracle 8i SQL? [message #281194] Fri, 16 November 2007 01:27 Go to next message
atgl
Messages: 25
Registered: March 2006
Junior Member
How to I use IF ELSE syntax in Oracle 8i SQL?
A sample scenerio as sample.
TableA
No       Name     SupID
 1       Mary      10
 2       Duncan     

TableB
SupID     SupName    Age
 10       Auntie     50
 20       Niece      10     


Expected Returned Result After A SQL
No    Name      SupName   Age
1     Mary      Auntie    50
2     Duncan    -         -


Thus, if there is value in SupID column for Table A, result show return SupName from table B else return nil for SupName.
How to further enhance my below sql to archieve above result?

Select a.no, a.name, b.supname, b.age
from tableA a, tableB b
where a.supID = b.supID
Re: How to user IF ELSE in Oracle 8i SQL? [message #281198 is a reply to message #281194] Fri, 16 November 2007 01:36 Go to previous messageGo to next message
Michel Cadot
Messages: 64145
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Use an outer join.

Regards
Michel
Re: How to user IF ELSE in Oracle 8i SQL? [message #281227 is a reply to message #281194] Fri, 16 November 2007 03:28 Go to previous message
atgl
Messages: 25
Registered: March 2006
Junior Member
Thank you. problem solved
Previous Topic: Consistency
Next Topic: date format
Goto Forum:
  


Current Time: Fri Dec 09 11:40:07 CST 2016

Total time taken to generate the page: 0.09067 seconds