1

I have this table, which worked perfectly fine in sql developer, but when I wanted to import it to the MySQL database this is what happend:

CREATE TABLE zem(
ID_zem INTEGER,
nazov VARCHAR2(30), 
kontinent VARCHAR2(30),

CONSTRAINT pk_zem PRIMARY KEY (ID_zem)
);

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VARCHAR2(30), kontinent VARCHAR2(30),

CONSTRAINT pk_zem PRIMARY KEY (ID_zem' at line 3

6
  • 1
    Please don't tag databases you're not using. I've removed oracle tag. Commented Nov 23, 2016 at 12:03
  • 2
    Well, you cannot use Oracle syntax with MySQL, no matter what client program you use. Commented Nov 23, 2016 at 12:04
  • ok then, is there any way I can import my databases with Oracle syntax? Or I need to rewrite them? Commented Nov 23, 2016 at 12:06
  • 1
    varchar2 is not supported by mysql use varchar instead of it... Commented Nov 23, 2016 at 12:07
  • 1
    No, you obviously cannot. How is MySQL going to know about other engines' data types? What about features that Oracle support and MySQL doesn't, such as check constraints or sequences? Commented Nov 23, 2016 at 12:12

3 Answers 3

2

change

VARCHAR2

to

VARCHAR

there is no varchar2 in mysql

Sign up to request clarification or add additional context in comments.

Comments

2

There is How to Create tables in MySql, for integer use value like INTEGER(11) -> but is not necessary and MySql does not have data type VARCHAR2, only VARCHAR

CREATE TABLE zem (
ID_zem INTEGER(11) not null,
nazov VARCHAR(30), 
kontinent VARCHAR(30),
PRIMARY KEY (ID_zem)
) ENGINE=INNODB;

2 Comments

What is ENGINE=INNODB?
Storage engine of MySql DB for your data, Storage Engines
1

Hope this helps

CREATE TABLE zem(
ID_zem INT,
nazov VARCHAR(30), 
kontinent VARCHAR(30),
CONSTRAINT pk_zem PRIMARY KEY (ID_zem)
);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.