Home » SQL & PL/SQL » SQL & PL/SQL » update
update [message #268706] Wed, 19 September 2007 07:42 Go to next message
oracle_coorgi
Messages: 188
Registered: September 2006
Location: INDIA-karnataka
Senior Member
hi
i have two column cust_id and remark in table cust
in cust_id i have thosands of records like two value of same cust_id eg:cust_id=1140,1140,1141,1141,1200,1200,1201,1201,1300,1300,1301,1301
how can i update the records in remark column for eg:1140 remark='admin' 1141 remark='clerk' and 1200 remark='admin' 1201 as remark ='clerk' so on...
Re: update [message #268712 is a reply to message #268706] Wed, 19 September 2007 07:51 Go to previous messageGo to next message
joy_division
Messages: 4727
Registered: February 2005
Location: East Coast USA
Senior Member
I would use a DECODE or a CASE statement. Or use a lookup table to map the values.
Re: update [message #268713 is a reply to message #268706] Wed, 19 September 2007 07:52 Go to previous messageGo to next message
pablolee
Messages: 2844
Registered: May 2007
Location: Scotland
Senior Member
Well, based on the info that you have supplied, the following will suit your needs. However, I'd be surprised if this was actually what you want

update cust1 set remark =  decode(mod(custid,2),0,'Admin','Clerk');
Re: update [message #268885 is a reply to message #268713] Thu, 20 September 2007 00:19 Go to previous message
oracle_coorgi
Messages: 188
Registered: September 2006
Location: INDIA-karnataka
Senior Member
hi
this is what i needed thanxs gr8..
Previous Topic: Snapshot refresh fails with ORA-12008, ORA-01410
Next Topic: Help w/CLOB error_v2
Goto Forum:
  


Current Time: Wed Apr 26 17:04:21 CDT 2017

Total time taken to generate the page: 0.06535 seconds