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

Update 5000 records using Update script

Status
Not open for further replies.

JenniferCheng

Programmer
Aug 10, 2005
34
CA
Hi,

I want to replace field "Customer_id" beginning with "MD" to beginning with "FH", and there are around 5000 records. If using update script, I need write 5000 scripts. Is there any good method or Oracle function?


Thanks in advance.
Jennifer
 
Jennifer,

Why can you not do the UPDATE with a single UPDATE statement (which is far more efficient than multiple UPDATE statements):
Code:
UPDATE <table_name>
   SET Customer_id = 'FH'||substr(customer_id,3)
 WHERE customer_id like 'MD%';
Let us know if this works for you.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I can provide you with low-cost, remote Database Administration services: see our website and contact me via www.dasages.com]
 
Hi,
Just be glad that there are not multiple tables that need this change due to some business rule modification or naming standard - especially if that field happened to be involved in an integrity constraint...




[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
It's okay, Turkbear, I've never been known to have much integrity anyway, and it's never been much of a constraint. [wink]

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I can provide you with low-cost, remote Database Administration services: see our website and contact me via www.dasages.com]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top