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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Table field update

Status
Not open for further replies.

dnelson24

IS-IT--Management
Apr 1, 2002
59
US
Can I get some help on how to update an Oracle 7 database table called ITM. I would like to update field SIZ_ID with FULL, TWIN, QUEEN, or KING based on the existence of the word FULL, TWIN, QUEEN, or KING in the DES field? The DES field is Description.....example being GEM FULL MATT!

Is there a way to do all records with one comand?
Also is there a way in the example above to take the first work in DES (i.e. GEM) and place it in a field called say GRADE_ID??

Thanks in advance!

dnelson24
 
Hi,
If I have understood your first problem (I'm french and my english is poor) you can try :
update itm
set siz_id = (select 'FULL' from dual
where des like '%FULL%'
union
select 'KING from dual
where des like '%KING%'
......
);
This doesn't work if you can have the words FULL and KING together in the same field DES.

To extract the fisrt word of a field use
grad_id=substr(DES,1,instr(DES,' '))
Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top