Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

create a view

Status
Not open for further replies.

thorny00

Programmer
Feb 20, 2003
122
US
I have a table in a warehouse, with FIRSTNAME, LASTNAME, INSTNAME i.e.

FIRSTNAME LASTNAME INSTNAME
HULK HOGAN
FRED FLINTSTONE
GEORGE BUSH
JOE BLOWS
STEVE SURFIN

What I'd like to do is create a new view with a field named FULLNAME that would look at INSTNAME to see if its null then concatenate LASTNAME, FIRSTNAME and move it to the new FULLNAME field, if INSTNAME is not null move INSTNAME to FULLNAME

All help is greatly appreciated
 
create view x as
select coalesce(instname,lastname||', '||firstname) as fullname
from tableInAWarehouse
 
And "more Oracle" syntax:

select
nvl(INSTNAME, FIRSTNAME||' '||LASTNAME) FULLNAME
from <your tab> Regards, Dima
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top