Home » SQL & PL/SQL » SQL & PL/SQL » problem with SQL CREATE TABLE
problem with SQL CREATE TABLE [message #441769] Wed, 03 February 2010 01:06 Go to next message
bmayr
Messages: 8
Registered: February 2010
Junior Member
Hi!
I'm rather new to sql, therefore some questions of mine may sound stupid. nevertheless I got tin rouble while creating new tables.

my sql insert-command:

CREATE TABLE IUS_Impeti (
	id 		INTEGER NOT NULL,
	creator 	VARCHAR(3) NOT NULL,
	create_date 	DATE NOT NULL,
	last_reviser 	VARCHAR(3),
	last_update 	DATE,
	short_descr 	VARCHAR(128),
	long_descr 	VARCHAR(2048),
	reference 	VARCHAR(128),
	status 		INTEGER
	CONSTRAINT pk_impeti PRIMARY KEY(id)
);


I get the following error: ORA-00907: missing right parenthesis. According to the error description, this error occurs if a a left paranthesis is not closed. well, this sounds very ovious but I have no idea where to find the corresponding left parenthesis.
Even if I add a right parenthesis, the error still occurs...
thank you for helping me!
Re: problem with SQL CREATE TABLE [message #441770 is a reply to message #441769] Wed, 03 February 2010 01:11 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You miss a comma sign (,) in front of the CONSTRAINT clause:
SQL> l10
 10*    status          INTEGER
SQL> a ,
 10*    status          INTEGER,
SQL> l
  1  CREATE TABLE IUS_Impeti (
  2     id              INTEGER NOT NULL,
  3     creator         VARCHAR(3) NOT NULL,
  4     create_date     DATE NOT NULL,
  5     last_reviser    VARCHAR(3),
  6     last_update     DATE,
  7     short_descr     VARCHAR(128),
  8     long_descr      VARCHAR(2048),
  9     reference       VARCHAR(128),
 10     status          INTEGER,                --> here!
 11     CONSTRAINT pk_impeti PRIMARY KEY(id)
 12* )
SQL> /

Table created.

SQL>
Re: problem with SQL CREATE TABLE [message #441772 is a reply to message #441769] Wed, 03 February 2010 01:16 Go to previous messageGo to next message
mohley_s
Messages: 10
Registered: January 2010
Location: bangalore, india
Junior Member
hi,

CREATE TABLE IUS_Impeti (
id INTEGER NOT NULL,
creator VARCHAR(3) NOT NULL,
create_date DATE NOT NULL,
last_reviser VARCHAR(3),
last_update DATE,
short_descr VARCHAR(128),
long_descr VARCHAR(2048),
reference VARCHAR(128),
status INTEGER,
CONSTRAINT pk_impeti PRIMARY KEY(id)
);


use this it will work
Re: problem with SQL CREATE TABLE [message #441773 is a reply to message #441772] Wed, 03 February 2010 01:18 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Use [code] tags, and your statement will look as pretty as mine.
Re: problem with SQL CREATE TABLE [message #441774 is a reply to message #441769] Wed, 03 February 2010 01:26 Go to previous messageGo to next message
bmayr
Messages: 8
Registered: February 2010
Junior Member
this works! thank you very much!
Re: problem with SQL CREATE TABLE [message #441777 is a reply to message #441774] Wed, 03 February 2010 01:35 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Do not use VARCHAR, use VARCHAR2.

Regards
Michel
Re: problem with SQL CREATE TABLE [message #441780 is a reply to message #441769] Wed, 03 February 2010 01:39 Go to previous messageGo to next message
bmayr
Messages: 8
Registered: February 2010
Junior Member
What's the difference between varchar and varchar2 ?
Re: problem with SQL CREATE TABLE [message #441782 is a reply to message #441780] Wed, 03 February 2010 01:44 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Currently they are synonymous.
Back to Oracle version 6 (or 5), at this time there was VARCHAR datatype with some semantics concerning blank padding, the options taken by Oracle did not match the standard, so Oracle introduced VARCHAR2 to fit the standard requirements and keep VARCHAR for backward compatibility.
In the next version, Oracle told that now VARCHAR is synonymous to VARCHAR2 but not to use it as this may change in the future.

Note that in Pro*C the C type is still named VARCHAR (there is no VARCHAR2), this to help to understand.

Regards
Michel
Re: problem with SQL CREATE TABLE [message #441783 is a reply to message #441769] Wed, 03 February 2010 01:46 Go to previous message
bmayr
Messages: 8
Registered: February 2010
Junior Member
thank you for the explanation!
regards
Previous Topic: IMPLICIT CONVERSION
Next Topic: Reference complete new-row in trigger (merged 2)
Goto Forum:
  


Current Time: Fri Dec 09 02:08:10 CST 2016

Total time taken to generate the page: 0.16056 seconds