MySQL Forums
Forum List  »  Newbie

oracle sequence conversion
Posted by: Mark Hutchinson
Date: September 29, 2004 06:39AM

I understand that MySQL does NOT support sequences in the way that Oracle does.

I need to convert a "flat" file into separate tables. Given the following structure, how do I point one table to another?

section
class1
entry1
entry2
entryN...
class2
entryN+1
entryN+2
entryN+N...
classN...

Do I have to keep track of all the IDs (like the first set of entry should have a classID field = 1 and the second set a classID = 2) or is there some way for MySQL to do it for me.

In the Oracle import file I had:

create sequence sectionID;
create sequence classID;
create sequence entryID;
insert into section values (sectionID.nextval,'YY','XX','XYZ');
insert into class values (classID.nextval,sectionID.currval,0,'Aaa','Aaa','AAA','','','');
insert into entry values (entryID.nextval,classID.currval,'Entry1');
insert into entry values (entryID.nextval,classID.currval,'Entry2');
insert into entry values (entryID.nextval,classID.currval,'Entry3');
insert into class values (classID.nextval,sectionID.currval,0,'Abb','Abb','ABB','','','');
insert into entry values (entryID.nextval,classID.currval,'Entry4');
insert into entry values (entryID.nextval,classID.currval,'Entry5');
insert into entry values (entryID.nextval,classID.currval,'Entry5');

I also had foreign and primary keys defined to relate everything together.

Is there a way to mimic this way of working in MySQL?


Options: ReplyQuote


Subject
Written By
Posted
oracle sequence conversion
September 29, 2004 06:39AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.