Home » SQL & PL/SQL » SQL & PL/SQL » Changing column data
Changing column data [message #251835] Mon, 16 July 2007 17:59 Go to next message
raoushan
Messages: 3
Registered: July 2007
Junior Member
Hi
I have to write a procedure to change the column data in a table .for eg if the column values are
item_name
1223
2334
234
2334
....( I have to change >16000 vales)
the column should look like this
Part 1
Part 2
Part 3
Part 4
....
Any idea how to implement the procedure/code
Thanks


Re: Changing column data [message #251836 is a reply to message #251835] Mon, 16 July 2007 18:04 Go to previous messageGo to next message
BlackSwan
Messages: 25050
Registered: January 2009
Location: SoCal
Senior Member
There is a forum specifcally for homework assignments BELOW.
Otherwise please read & FOLLOW the posting guidelines as listed in the STICKY posts at the top of this forum.

[Updated on: Mon, 16 July 2007 18:04] by Moderator

Report message to a moderator

Re: Changing column data [message #251871 is a reply to message #251835] Tue, 17 July 2007 01:04 Go to previous messageGo to next message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
Any idea how to implement the procedure/code

Yes I have several ones and you?
Post what you already tried (formatted of course) or thought?

Regards
Michel
Re: Changing column data [message #251993 is a reply to message #251871] Tue, 17 July 2007 11:09 Go to previous messageGo to next message
raoushan
Messages: 3
Registered: July 2007
Junior Member
Name is the column im trying to update
I am just trying to update 10 rows first and check the changes


create or replace procedure blah as
x NUMBER := 1;
y NUMBER := 1;
BEGIN
LOOP
IF(y < 10 )
THEN
update abc set item = 'Part '|| x where key < 10 ;
x := x + 1;
y := y + 1;
end if ;
end loop;
end;
Re: Changing column data [message #251995 is a reply to message #251993] Tue, 17 July 2007 11:12 Go to previous messageGo to next message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
And what does this give you?
What is "key"? There is only item_data in the table you posted.

Regards
Michel
Re: Changing column data [message #252013 is a reply to message #251995] Tue, 17 July 2007 12:24 Go to previous messageGo to next message
raoushan
Messages: 3
Registered: July 2007
Junior Member
key is the unique column in the table .The table has overall 26 columns and among them i have to change one column that has all item numbers and i have to change them to a string name eg item 1, item 2 ....

There are no changes to the table .Query is taking more than 1 hr to execute as table size is huge
Re: Changing column data [message #252023 is a reply to message #252013] Tue, 17 July 2007 12:40 Go to previous message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
So post a test case with only the relevant columns and about 10 rows and what would be the result.

Regards
Michel
Previous Topic: Sql query
Next Topic: quota
Goto Forum:
  


Current Time: Sat Dec 10 20:20:59 CST 2016

Total time taken to generate the page: 0.11890 seconds