This question already has an answer here:
Create table error - invalid identifier
(1 answer)
Closed 9 years ago.
I'm trying to create a simple table, but I'm receiving error:
ORA-00904 - invalid identifier
and I'm not sure why. I don't see anything that could be causing the issue (using Oracle 11g Express):
CREATE TABLE Measurements(
MeasureAmountID SMALLINT PRIMARY KEY,
MeasurementDescription VARCHAR(255),
);
Remove the comma at the end and try,
CREATE TABLE Measurements(
MeasureAmountID SMALLINT PRIMARY KEY,
MeasurementDescription VARCHAR(255)
);
Related
This question already has answers here:
How do I find duplicate values in a table in Oracle?
(13 answers)
Closed 6 months ago.
I have a problem when I tried to create a unique index
CREATE UNIQUE INDEX "PITEST000002_500"."IX_BBF3E90F" ON
"PITEST000002_500"."FRIENDLYURLENTRYLOCALIZATION"
("FRIENDLYURLENTRYID","LANGUAGEID","CTCOLLECTIONID");
I get the following error :
Error report -
ORA-01452: cannot CREATE UNIQUE INDEX; duplicate keys found
01452. 00000 - "cannot CREATE UNIQUE INDEX; duplicate keys found"
*Cause:
*Action:
The reason as I understood is I have some duplicated values.
The question is, how do I know what are the values that cause the issue ?
Anyone can help please ?
Just run a query that shows the values that appear in multiple rows
select "FRIENDLYURLENTRYID","LANGUAGEID","CTCOLLECTIONID", count(*)
from "PITEST000002_500"."FRIENDLYURLENTRYLOCALIZATION"
group by "FRIENDLYURLENTRYID","LANGUAGEID","CTCOLLECTIONID"
having count(*) > 1
Referring to this oracle website http://docs.oracle.com/javadb/10.4.2.1/ref/rrefblob.html, I tried executing this query (from the abovementioned page)
create table pictures(name varchar(32) not null primary key, pic blob(16M));
I am getting the error
Error starting at line : 1 in command -
create table pictures(name varchar(32) not null primary key, pic blob(16M))
Error report -
SQL Error: ORA-00907: missing right parenthesis
00907. 00000 - "missing right parenthesis"
*Cause:
*Action:
I am unable to understand where exactly there is a missing parenthesis.
Can anyone explain?
There is no need to specify the size for the blob. Thats why you are getting an error for the missing parenthesis.
This statement would work.
create table pictures(name varchar(32) not null primary key, pic blob);
The oracle doc explains everything clearly.
While doing an import in an oracle 10G database using imp, I receive following error:
IMP-00017: following statement failed with ORACLE error 604:
CREATE TABLE DASHBOARD_ADMINISTRATOR
(ID NUMBER(19, 0) NOT NULL ENABLE,
USER_NAME VARCHAR2(20) NOT NULL ENABLE,
NAME VARCHAR2(50), FIRST_NAME VARCHAR2(50));
IMP-00003: ORACLE error 604 encountered
ORA-00604: error occurred at recursive SQL level 1
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at line 22
When doing the same thing in TOAD, I have the same error even if I only try to create the table with only 1 column specificied, which is even more strange since I only have 2 lines...
Creating a table called DASHBOARD_ADMINISTRATO is possible, DASHBOARD_ADMINISTRATORR gives again the same error.
However, when I switch places of the words in the name, it works fine.
There is no limit set on tablename length because several of the imported tables have more characters.
I used the same dumpfile to import into oracle 11G and there it was successful.
Any ideas, someone?
Thx for your help.
"character string buffer too small" - Mayby try to increase Varchar Tables. And change number(19,0) to number(19) - ID's is just an integer, they don't have coma, period. In importing/exporting various scenarios came out :)
While I am creating a table In MySql, I am getting an error. I don't know What the problem is, but it will be helpful if I understand the reason behinId it.
Query:
create table publish(
From varcahar(60),
To varchar(60)
);
ERROR 1064 (42000): 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 'From varcahar(60),To varchar(60))' at line 1
Several errors:
1.- From and To are reserverd words you need to escape them
2.- varcahr -> varchar
Final code:
create table publish(
`From` varchar(60),
`To` varchar(60)
);
It says varcahr(60) not varchar(60)
Spelling problem
create table publish(From varchar(60),To varchar(60));
This is the right one. You misspelled varchar
And also From and To are reserved words. Check this Reserved Words In MySql
I'm getting an
ORA-00907 error, missing right parenthesis
when attempting to create a table w MySQL.
I have looked extensively on the web but found nothing that could help me here..
Here is my CREATE TABLE statement:
CREATE TABLE station
(
nomStation varchar2(255),
capacite number(15) NOT NULL,
lieu varchar2(255) NOT NULL,
region ENUM('Quebec', 'Ontario', 'NewBrunswick', 'NovaScotia'),
tarif number(10) DEFAULT 0,
CONSTRAINT station_nomStation_pk PRIMARY KEY(nomStation)
);
In my experience, "ORA-00907 error, missing right parenthesis" is usually triggered by a wrong number of commas, like adding an extra comma after your final column or constraint.
However, in your case some googling seems to indicate that Oracle doesn't support the ENUM syntax you're using. Instead, you should use a CHECK, like described in this blog post.