2

I need to create a tables for my image album. When i execute my code it is showing the error java.sql.SQLSyntaxErrorException: ORA-00907: missing right parenthesis I'm not understanding what it mean. I tried same query with sql plus it was showing same error.But in sql developer table creates successfully.

Statement st21=con.createStatement();
StringBuilder sb21=new StringBuilder(1024);
sb21.append("create table ").append(uname).append("album(ALBUMID NUMBER NOT NULL AUTO_INCREMENT, ALBUMNAME VARCHAR2(225) NOT NULL, CONSTRAINT USERALBUM_PK PRIMARY KEY(ALBUMID)ENABLE);CREATE INDEX USERALBUM_INDEX ON USERALBUM (ALBUMNAME);");
String Query21=sb21.toString();
st21.executeUpdate(Query21);

Statement st2=con.createStatement();
StringBuilder sb2=new StringBuilder(1024);
sb2.append("create table ").append(uname).append("image(IMAGEID NUMBER NOT NULL AUTO_INCREMENT, IMAGENAME VARCHAR2(225) NOT NULL, IMAGEFULL BLOB NOT NULL, IMAGEDISC VARCHAR2(225), ALBUMID NUMBER NOT NULL, CONSTRAINT USERIMAGE_PK PRIMARY KEY(IMAGEID)ENABLE);ALTER TABLE USERIMAGE ADD CONSTRAINT USERIMAGE_USERALBUM_FK1 FOREIGN KEY(ALBUMID)REFERENCES USERALBUM(ALBUMID)ENABLE;CREATE INDEX USERIMAGE_INDEX ON USERIMAGE (IMAGENAME);");
String Query2=sb2.toString();
st2.executeUpdate(Query2);

Please tell me what is the error in these statements.

1 Answer 1

0

Oracle doens't support the keyword AUTO_INCREMENT.

Here are guides on how to simulate AUTO_INCREMENTing field

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

Comments

Your Answer

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