Home » SQL & PL/SQL » SQL & PL/SQL » mysql to oracle (oracle 11g)
mysql to oracle [message #595109] Fri, 06 September 2013 14:48 Go to next message
vkanuri
Messages: 18
Registered: August 2013
Location: United States
Junior Member
Hi ,
I have a task where i need to convert mysql code to oracle pl/sql.For now I am doing part by part.Can anyone please help me how to convert following part of mysql to oracle.


CREATE TABLE `A` (
  `A_ID` int(11) NOT NULL AUTO_INCREMENT,
  `PROCESS_RUN_ID` int(11) DEFAULT NULL,
  `START_DATATIME` varchar(45) DEFAULT NULL,
  `STOP_DATATIME` varchar(45) DEFAULT NULL,
  `DATA_COUNT` int(11) DEFAULT NULL,
  PRIMARY KEY (`A_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1


I know how to write for fields PROCESS_RUN_ID,START_DATATIME,DATA_COUNT,PRIMARY KEY (`A_ID`).My question is how to write for column `A_ID` int(11) NOT NULL AUTO_INCREMENT and for ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1.

Thanks..
Re: mysql to oracle [message #595110 is a reply to message #595109] Fri, 06 September 2013 14:53 Go to previous messageGo to next message
Michel Cadot
Messages: 57612
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
My question is how to write for column `A_ID` int(11) NOT NULL AUTO_INCREMENT


Just Google for "oracle auto increment" and you will have many examples.

Quote:
ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1


Irrelevant in Oracle.

Regards
Michel
Re: mysql to oracle [message #595111 is a reply to message #595110] Fri, 06 September 2013 14:55 Go to previous messageGo to next message
BlackSwan
Messages: 21946
Registered: January 2009
Senior Member
Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/
Re: mysql to oracle [message #595112 is a reply to message #595110] Fri, 06 September 2013 14:56 Go to previous messageGo to next message
vkanuri
Messages: 18
Registered: August 2013
Location: United States
Junior Member
Thanks for the reply.When i see in google I understood that for autoincrement in oracle need to create a sequence.Am I correct?
Re: mysql to oracle [message #595113 is a reply to message #595112] Fri, 06 September 2013 15:01 Go to previous messageGo to next message
BlackSwan
Messages: 21946
Registered: January 2009
Senior Member
vkanuri wrote on Fri, 06 September 2013 12:56
Thanks for the reply.When i see in google I understood that for autoincrement in oracle need to create a sequence.Am I correct?

correct
Re: mysql to oracle [message #595114 is a reply to message #595113] Fri, 06 September 2013 15:03 Go to previous messageGo to next message
vkanuri
Messages: 18
Registered: August 2013
Location: United States
Junior Member
ok thanks.
Re: mysql to oracle [message #595121 is a reply to message #595114] Sat, 07 September 2013 00:37 Go to previous messageGo to next message
Michel Cadot
Messages: 57612
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
a sequence... and a trigger...

Regards
Michel
Re: mysql to oracle [message #595356 is a reply to message #595121] Tue, 10 September 2013 09:53 Go to previous messageGo to next message
Bill B
Messages: 1049
Registered: December 2004
Senior Member
...or in oracle 12 they have the identity column.

CREATE TABLE identity_test_tab (
id NUMBER GENERATED ALWAYS AS IDENTITY,
description VARCHAR2(30)
);
Re: mysql to oracle [message #595392 is a reply to message #595356] Tue, 10 September 2013 16:22 Go to previous messageGo to next message
vkanuri
Messages: 18
Registered: August 2013
Location: United States
Junior Member
Thanks for the reply.My client is using oracle 11g.
Re: mysql to oracle [message #595406 is a reply to message #595392] Wed, 11 September 2013 00:51 Go to previous message
Michel Cadot
Messages: 57612
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
We now it and we answered you; Bill just extends your case for those that have the latest version.

Regards
Michel
Previous Topic: Select column values into array
Next Topic: how to find the parent/host procedure's name within the procedure
Goto Forum:
  


Current Time: Sat Apr 19 08:30:59 CDT 2014

Total time taken to generate the page: 0.10001 seconds