MySQL Forums
Forum List  »  Oracle

Converting an Oracle script to MySQL
Posted by: Padma N
Date: December 07, 2011 02:13PM

Hi,

I am in the process of migrating from Oracle to MySQL. I am trying to convert some scripts written in Oracle to MySQL. I found a statement that is trying to insert data into some table with a sequence.nextval. Since there are no sequences in MySQL. how do I fix this in the script? I cannot use AUTO_INCREMENT because that is set at table level. But this sequence.nextval is used to insert into multiple tables.

The sequence is

CREATE SEQUENCE "HIBERNATE_SEQ" MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 621 CACHE 20 NOORDER NOCYCLE ;

Inserts into tables

INSERT INTO ABS_DEFINE (ID, CODE, NAME, VERSION, ACT)
VALUES (HIBERNATE_SEQUENCE.NEXTVAL, 'abc', 'dest', 1, 1);

INSERT INTO ABS (ID, NAME, VERSION, ACT)
SELECT HIBERNATE_SEQUENCE.NEXTVAL, NAME, 1, ACTIVE FROM GET_POLICY;

Options: ReplyQuote


Subject
Views
Written By
Posted
Converting an Oracle script to MySQL
4343
December 07, 2011 02:13PM


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.