Home » SQL & PL/SQL » SQL & PL/SQL » Serialize an existing table (Oracle 9i - windows)
Serialize an existing table [message #377258] Mon, 22 December 2008 02:57 Go to next message
dahshant
Messages: 3
Registered: December 2008
Junior Member
How to serialize an existing table with data?

Re: Serialize an existing table [message #377266 is a reply to message #377258] Mon, 22 December 2008 03:14 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
I have no idea what you want.

Please describe your problem using more than 8 words.
Re: Serialize an existing table [message #377275 is a reply to message #377266] Mon, 22 December 2008 03:34 Go to previous messageGo to next message
dahshant
Messages: 3
Registered: December 2008
Junior Member
I have a table containing more than 5000 rows, I added new field to be as serial number. Now I need to know how could I serialize the data into this table?
Re: Serialize an existing table [message #377277 is a reply to message #377275] Mon, 22 December 2008 03:38 Go to previous messageGo to next message
Frank Naude
Messages: 4502
Registered: April 1998
Senior Member
What database management system are you using? Oracle? If so, see sequence.
Re: Serialize an existing table [message #377279 is a reply to message #377275] Mon, 22 December 2008 03:44 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
In Oracle, the word 'serialize' refers to a type of transaction isolation level.

I'm guessing (and given the information you've provided, guessing is the best you'll get) that this isn't what you want.

Are you wanting to populate this new column with a monotonically increasing number - if so, you need a sequence.

Here's an example:
create table test_050 (col_1 varchar2(10), col_2 number);

insert into test_050 (col_1) select chr(64+level) from dual connect by level<=10;

create sequence test_050_seq;

update (select col_2 from test_050 order by col_1)
set col_2 = test_050_seq.nextval;


select * from test_050 order by col_1;
Re: Serialize an existing table [message #377287 is a reply to message #377258] Mon, 22 December 2008 04:16 Go to previous messageGo to next message
dahshant
Messages: 3
Registered: December 2008
Junior Member
I would like to thank you very much for your help. I create a sequence then update table.

Tarek
Re: Serialize an existing table [message #377376 is a reply to message #377287] Mon, 22 December 2008 10:33 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Or, without a sequence, ROWNUM might do the job:
SQL> update test_050 set col_2 = rownum;

10 rows updated.

SQL> select * from test_050;

COL_1           COL_2
---------- ----------
A                   1
B                   2
C                   3
D                   4
E                   5
F                   6
G                   7
H                   8
I                   9
J                  10

10 rows selected.

SQL>
Re: Serialize an existing table [message #377454 is a reply to message #377258] Tue, 23 December 2008 03:02 Go to previous messageGo to next message
dr.s.raghunathan
Messages: 540
Registered: February 2008
Senior Member
http://www.orafaq.com/papers/rownum.doc
sorry for the belated reply
Re: Serialize an existing table [message #377457 is a reply to message #377454] Tue, 23 December 2008 03:05 Go to previous message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Don't be sorry the answer was already given.

Regards
Michel
Previous Topic: Passing multiple value
Next Topic: calling procedure inside a procedure
Goto Forum:
  


Current Time: Thu Dec 08 22:19:20 CST 2016

Total time taken to generate the page: 0.12212 seconds